GNU bug report logs - #25724
sed (bug or wrong command ?)

Previous Next

Package: sed;

Reported by: Enrico Magrì <enrico_magri <at> hotmail.com>

Date: Tue, 14 Feb 2017 17:08:02 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Enrico Magrì <enrico_magri <at> hotmail.com>
To: 25724 <at> debbugs.gnu.org
Subject: bug#25724: sed (bug or wrong command ?)
Date: Tue, 14 Feb 2017 10:16:37 +0000
[Message part 1 (text/plain, inline)]
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 :)



The version of sed is the following:

C:\Users\enrico_vf>sed --version
GNU sed version 3.02

Copyright (C) 1998 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.



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



LIT002604+enrico <at> 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 <at> LIT002604 ~/test





Thanks in advance for your help



Enrico



[Message part 2 (text/html, inline)]

This bug report was last modified 8 years and 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.