bug-gnu-utils
[Top][All Lists]
Advanced

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

R: sed (bug or wrong command ?)


From: Enrico Magrì
Subject: R: sed (bug or wrong command ?)
Date: Sat, 11 Feb 2017 11:45:22 +0000

I tried also with SED of CYGWIN and all woks correctly:

address@hidden ~/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

address@hidden ~/test

Da: Enrico Magrì
Inviato: sabato 11 febbraio 2017 12:32
A: 'address@hidden'
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


reply via email to

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