<br><br><div class="gmail_quote">2010/5/13 Mohamed El Morabity <span dir="ltr">&lt;<a href="mailto:pikachu.2014@gmail.com">pikachu.2014@gmail.com</a>&gt;</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">&gt; Hello,<br>
&gt; sorry for the offtopic. it seems a simple thing but I can&#39;t find an<br>
&gt; escape char or something correct...<br>
&gt; I have this setup in place<br>
&gt; source file input.txt:<br>
&gt;<br>
&gt; bla bla<br>
&gt; bla bla<br>
&gt; TAG<br>
&gt; bla bla<br>
&gt;<br>
&gt; sed command file sed.txt:<br>
&gt;<br>
&gt; /TAG/c\<br>
&gt; BLABLA .... BLABLA<br>
&gt;<br>
&gt; so that the command<br>
&gt; sed -f sed.txt input.txt<br>
&gt; gives as output<br>
&gt;<br>
&gt; bla bla<br>
&gt; bla bla<br>
&gt; BLABLA .... BLABLA<br>
&gt; bla bla<br>
&gt;<br>
&gt; Suppose I want now to substitute the TAG pattern with a multi-line<br>
&gt; pattern, for example<br>
&gt; occurences of<br>
&gt; TAG<br>
&gt; must become 2 lines:<br>
&gt; BLABLA<br>
&gt; BLOBLO<br>
&gt;<br>
&gt; How can I achieve this?<br>
&gt; Thanks in advance,<br>
&gt;<br>
&gt; 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 &quot; %s:TAG:BLABLA(crtl-v)(crtl-m)BLOBLO: &quot;.  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>