Conall O'Brien wrote:
> Hello,
>>> Since the recent thread on grep seems to be full of useful tips, I
> wonder if anyone can help me with a small issue I have.
>>> I've a shell script I'm working on to take individual BIND9 zone
> files and transfer them (via ssh) from the master ns to the slave ns,
> editing them accordingly in transit (using sed).
>>>> 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; }/'
>>> to no avail. Any suggestions how I can achieve this replacement?
>>
Hy,
sed -e 's/notify yes;/notify no;@masters { $IP; }/' | tr '@' '\n'
Regards,
A.
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!