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."
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!