GNU bug report logs -
#47390
-i and -n options are order-sensitive
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
To remove the first N lines from a big text file I used to do:
sed -in '1,Nd' bigfile.txt
and it was working as expected. Assuming the order of the flags does not
matter I did once:
sed -ni '1,Nd' bigfile.txt
which deleted the whole content of the file. Is this behaviour expected?
From the user point of view this seems like a rather dangerous bug. I
think, flags not taking an argument should be insensitive to the order.
Currently, to get the same result without running the risk to forget the
right order of the flags and deleting the file content, I do:
sed -i -e '1,Nd' bigfile.txt
(Using GNU sed 4.4 or 4.8)
Cheers,
Raffaele
This bug report was last modified 4 years and 50 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.