[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: don't work '\n' in Gnu SED for windows
From: |
Dave B |
Subject: |
Re: don't work '\n' in Gnu SED for windows |
Date: |
Wed, 20 Aug 2008 10:03:45 +0200 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080725) |
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!!
>
> ==============================================
> command line :
> sed -i -f myRegExp.txt mySource.txt
>
> myRegExt.txt :
> s/<\/ejb>\n\W<method>/I_WANT_CHANGE/g
>
>
> mySource.txt :
> ...
> <ejb>com.krondor.myPackage</ejb>
> <method>myMethod</method>
> ....
> ==============================================
>
> The matter is '\n'...
> even "s/\n/_MyEnter_/g" doesn't work.
> Did i made an mistake??
>
>
> Any help will be appreciated.
See question 5.10 in the sed FAQ:
http://student.northpark.edu/pemente/sed/sedfaq5.html#s5.10
You can't match a \n in the way you're trying to do. At least, you need to
read two lines in the pattern space.
And (but I'm not sure about this as I've never tried) under windows you'll
probably need to use \n\r instead of just \n.
--
D.