[OT] replace a word with a multiline with sed

Gianluca Cecchi gianluca.cecchi at gmail.com
Thu May 13 16:14:22 UTC 2010


Hello,
sorry for the offtopic. it seems a simple thing but I can't find an escape
char or something correct...
I have this setup in place
source file input.txt:

bla bla
bla bla
TAG
bla bla

sed command file sed.txt:

/TAG/c\
BLABLA .... BLABLA

so that the command
sed -f sed.txt input.txt
gives as output

bla bla
bla bla
BLABLA .... BLABLA
bla bla

Suppose I want now to substitute the TAG pattern with a multi-line pattern,
for example
occurences of
TAG
must become 2 lines:
BLABLA
BLOBLO

How can I achieve this?
Thanks in advance,

Gianluca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20100513/11c5c2a4/attachment.html 


More information about the users mailing list