LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Another Scripting Question...

[ILUG] Another Scripting Question...

Michael Armbrecht michael.armbrecht at gmail.com
Fri Jul 29 12:23:50 IST 2005


On 29/07/05, Conall O'Brien <conall+ilug at conall.net> wrote:

> My only problem is I'm trying to do a multi line replace in sed
> 
> 
> eg sed -e 's/notify yes;/notify no;\nmasters { $IP; }/'
> 
> 
> Everything works except for the newline control character I want for
> human readability (sed doesn't like the newline character in the
> replacement part of the expression.)
> 
> 
> I've also tried
> 
> sed -e 's/notify yes;/notify no; \
> masters { $IP; }/'

"\n" in replacement patterns has a special meaning to sed (restore by
the nth pattern previously matched). The only way I could make it work
is to enter the hex code of a line feed (x0A) into the replacement
pattern like this:
sed -e 's/notify yes;/notify no; \x0A masters { $IP;}/' 

HTH
Michael


-- 
"Microwave oven?  Whaddya mean, it's a microwave oven?  I've been
watching Channel 4 on the thing for two weeks."



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell