bug-sed
[Top][All Lists]
Advanced

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

bug#25724: R: bug#25724: sed (bug or wrong command ?)


From: Enrico Magrì
Subject: bug#25724: R: bug#25724: sed (bug or wrong command ?)
Date: Thu, 16 Feb 2017 22:37:47 +0000

Hi Gordon,
thanks for the information; ok I'll try in this way. Do you know the http link 
where I can download the updated sed.exe for windows ?
Currently I founded only this link for windows OS: 
http://unxutils.sourceforge.net/
but I believe that it's not the updated package.

Best Regards,
Enrico


-----Messaggio originale-----
Da: Assaf Gordon [mailto:address@hidden 
Inviato: mercoledì 15 febbraio 2017 16:43
A: Enrico Magrì
Cc: address@hidden
Oggetto: Re: bug#25724: sed (bug or wrong command ?)

tag 25724 notabug
close 25724
stop

Hello,

On Tue, Feb 14, 2017 at 10:16:37AM +0000, Enrico Magrì wrote:
>I would like to insert new line at the begin of my txt file and in this line 
>to insert the word “ciao”.
>
[...]
>C:\config>sed "1,1s/^/ciao \n /g" comandi-capture.txt
>
>ciao n capture CAP-IP-85.205.221.241 type raw-data interface OUTSIDE 
>circular-buffer match ip any host 85.205.221.241

[...]
>
>I tried also with SED of CYGWIN and all woks correctly:
>
>$ sed "1,1s/^/ciao\n/g" comandi-capture.txt
>
>ciao
>
>capture CAP-IP-85.205.221.241 type raw-data interface OUTSIDE 
>circular-buffer match ip any host 85.205.221.241


[...]

>The version of sed is the following:
>
>C:\Users\enrico_vf>sed --version
>GNU sed version 3.02


First,
sed version 3.02 is 19 years old. (!)
It is highly recommended to upgrade to a newer version.
sed version 4.4 was released just this month.

I'm quite certain that the 'sed' you use on cygwin is newer than the 'sed' you 
use directly in cmd.exe.


Second,
Instead of replacing the beginning of the line, consider using the 'i' 
(insert') command.
The following should work even on sed-3.02:

   sed -e '1i\' -e 'ciao' comandi-capture.txt

To learn more about this syntax, see the 'i' command in this section:
https://www.gnu.org/software/sed/manual/sed.html#Other-Commands




As such I'm closing this ticket, but discussion can continue by replying to 
this thread.

regards,
 - assaf


reply via email to

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