R: sed (bug or wrong command ?)
Enrico Magrì <[email protected]> Sat, 11 Feb 2017 11:45:22 +0000
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Message-ID | <DB6PR0802MB2520CB2DDC0B3F255308CE32FC470@DB6PR0802MB2520.eurprd08.prod.outlook.com> |
I tried also with SED of CYGWIN and all woks correctly: LIT002604+enrico@LIT002604 ~/test $ 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 capture CAP-IP-85.205.221.240 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.240 capture CAP-IP-85.205.94.250 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.94.250 capture CAP-IP-85.205.207.116 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.116 capture CAP-IP-85.205.221.220 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.220 capture CAP-IP-85.205.221.218 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.218 capture CAP-IP-85.205.207.99 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.99 capture CAP-IP-85.205.217.252 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.252 capture CAP-IP-85.205.221.245 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.245 capture CAP-IP-85.205.207.46 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.46 capture CAP-IP-85.205.221.239 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.239 capture CAP-IP-85.205.221.232 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.232 capture CAP-IP-85.205.94.238 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.94.238 capture CAP-IP-85.205.221.237 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.237 capture CAP-IP-85.205.207.113 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.113 capture CAP-IP-85.205.217.232 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.232 capture CAP-IP-85.205.217.240 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.240 capture CAP-IP-85.205.217.241 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.241 capture CAP-IP-85.205.219.160 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.219.160 capture CAP-IP-85.205.221.213 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.213 capture CAP-IP-85.205.221.231 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.231 capture CAP-IP-85.205.221.234 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.234 capture CAP-IP-85.205.221.243 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.243 capture CAP-IP-85.205.221.248 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.248 capture CAP-IP-85.205.221.250 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.250 show capture LIT002604+enrico@LIT002604 ~/test Da: Enrico Magrì Inviato: sabato 11 febbraio 2017 12:32 A: '[email protected]' Oggetto: sed (bug or wrong command ?) Hi, I would like to insert new line at the begin of my txt file and in this line to insert the word "ciao". The file is this: C:\config>cat comandi-capture.txt capture CAP-IP-85.205.221.241 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.241 capture CAP-IP-85.205.221.240 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.240 capture CAP-IP-85.205.94.250 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.94.250 capture CAP-IP-85.205.207.116 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.116 capture CAP-IP-85.205.221.220 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.220 capture CAP-IP-85.205.221.218 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.218 capture CAP-IP-85.205.207.99 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.99 capture CAP-IP-85.205.217.252 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.252 capture CAP-IP-85.205.221.245 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.245 capture CAP-IP-85.205.207.46 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.46 capture CAP-IP-85.205.221.239 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.239 capture CAP-IP-85.205.221.232 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.232 capture CAP-IP-85.205.94.238 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.94.238 capture CAP-IP-85.205.221.237 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.237 capture CAP-IP-85.205.207.113 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.113 capture CAP-IP-85.205.217.232 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.232 capture CAP-IP-85.205.217.240 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.240 capture CAP-IP-85.205.217.241 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.241 capture CAP-IP-85.205.219.160 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.219.160 capture CAP-IP-85.205.221.213 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.213 capture CAP-IP-85.205.221.231 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.231 capture CAP-IP-85.205.221.234 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.234 capture CAP-IP-85.205.221.243 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.243 capture CAP-IP-85.205.221.248 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.248 capture CAP-IP-85.205.221.250 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.250 show capture I type this command: sed "1,1s/^/ciao \n /g" comandi-capture.txt the output is: 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 capture CAP-IP-85.205.221.240 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.240 capture CAP-IP-85.205.94.250 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.94.250 capture CAP-IP-85.205.207.116 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.116 capture CAP-IP-85.205.221.220 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.220 capture CAP-IP-85.205.221.218 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.218 capture CAP-IP-85.205.207.99 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.99 capture CAP-IP-85.205.217.252 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.252 capture CAP-IP-85.205.221.245 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.245 capture CAP-IP-85.205.207.46 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.46 capture CAP-IP-85.205.221.239 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.239 capture CAP-IP-85.205.221.232 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.232 capture CAP-IP-85.205.94.238 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.94.238 capture CAP-IP-85.205.221.237 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.237 capture CAP-IP-85.205.207.113 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.207.113 capture CAP-IP-85.205.217.232 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.232 capture CAP-IP-85.205.217.240 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.240 capture CAP-IP-85.205.217.241 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.217.241 capture CAP-IP-85.205.219.160 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.219.160 capture CAP-IP-85.205.221.213 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.213 capture CAP-IP-85.205.221.231 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.231 capture CAP-IP-85.205.221.234 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.234 capture CAP-IP-85.205.221.243 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.243 capture CAP-IP-85.205.221.248 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.248 capture CAP-IP-85.205.221.250 type raw-data interface OUTSIDE circular-buffer match ip any host 85.205.221.250 show capture I would like see the word "ciao" and then in a new line the rest of the file. It seems that \n is not work or I type the wrong command :) Thanks in advance for your help Enrico