<br><br><div class="gmail_quote">2010/5/13 Mohamed El Morabity <span dir="ltr"><<a href="mailto:pikachu.2014@gmail.com">pikachu.2014@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Le jeudi 13 mai 2010 à 18:14 +0200, Gianluca Cecchi a écrit :<br>
<div><div></div><div class="h5">> Hello,<br>
> sorry for the offtopic. it seems a simple thing but I can't find an<br>
> escape char or something correct...<br>
> I have this setup in place<br>
> source file input.txt:<br>
><br>
> bla bla<br>
> bla bla<br>
> TAG<br>
> bla bla<br>
><br>
> sed command file sed.txt:<br>
><br>
> /TAG/c\<br>
> BLABLA .... BLABLA<br>
><br>
> so that the command<br>
> sed -f sed.txt input.txt<br>
> gives as output<br>
><br>
> bla bla<br>
> bla bla<br>
> BLABLA .... BLABLA<br>
> bla bla<br>
><br>
> Suppose I want now to substitute the TAG pattern with a multi-line<br>
> pattern, for example<br>
> occurences of<br>
> TAG<br>
> must become 2 lines:<br>
> BLABLA<br>
> BLOBLO<br>
><br>
> How can I achieve this?<br>
> Thanks in advance,<br>
><br>
> Gianluca<br>
<br>
</div></div>Hi,<br>
<br>
simply using the following pattern for sed?<br>
/TAG/c\<br>
BLABLA\nBLOBLO<br>
<br>
<br>
<br>--<br>
users mailing list<br>
<a href="mailto:users@lists.fedoraproject.org">users@lists.fedoraproject.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="https://admin.fedoraproject.org/mailman/listinfo/users" target="_blank">https://admin.fedoraproject.org/mailman/listinfo/users</a><br>
Guidelines: <a href="http://fedoraproject.org/wiki/Mailing_list_guidelines" target="_blank">http://fedoraproject.org/wiki/Mailing_list_guidelines</a><br>
<br></blockquote></div><br>I have used something like that but I tend to do it through vi/vim with a (crtl-v)(crtl-m) to get a ^M character. So in vim it is " %s:TAG:BLABLA(crtl-v)(crtl-m)BLOBLO: ". It should work with sed as well but the file I last used this one did not like me replacing the other special character with the ^M but it would let me do it in vim with sed.<br>
<br>- Adam<br><br>