bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47390: -i and -n options are order-sensitive


From: rgrosso
Subject: bug#47390: -i and -n options are order-sensitive
Date: Thu, 25 Mar 2021 10:41:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]