On 22/07/2016 09:02, Daniel Iancu wrote: > Package: sed > Version: 4.2.2-4+b1 > Severity: normal > > Sed silently fails when -n option is specified first and leaves > the file blank. Thus resulting in the loss of the file contents. > Example: > # cd /tmp > echo 'foo' > test > sed -ni 's/foo/bar/' test # fails > > echo 'foo' > test > sed -in 's/foo/bar/' test # works
"-n" says "do not print anything by default", so sed is working as expected---not printing anything since you don't have a "w" command. "-in" says "do in-place editing and leave a backup in a file whose name is the input file name followed by 'n'". In this case sed adds a default print action at the end of the loop. So this is not a bug. Paolo