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

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

Re: don't work '\n' in Gnu SED for windows


From: Paolo Bonzini
Subject: Re: don't work '\n' in Gnu SED for windows
Date: Wed, 20 Aug 2008 09:58:39 +0200
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)

address@hidden wrote:
Hi, everybody.

I'm trying to change some string in a text file with GNU SED(FOR
WINDOWS)
but it seems that '\n' is not work!!

From http://www.gnu.org/software/sed/manual/html_node/Execution-Cycle.html

sed operates by performing the following cycle on each line of input: first, sed reads one line from the input stream, removes any trailing newline, and places it in the pattern space. Then commands are executed. When the end of the script is reached, the contents of pattern space are printed.



This means that newlines do *not* get into the pattern space. You cannot expect to use \n to match multiple lines of input. There are some tricks to do this however -- for more info look on http://sed.sf.net/grabbag for tutorials and example scripts.

(To other people on bug-gnu-utils: I'm considering putting this in the NON-BUGS section of the manual. Do you have any suggestion on the wording?)

Paolo




reply via email to

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