in reply to Re^2: Substitution inside tags, as 1 line
in thread Substitution inside tags, as 1 line

Slightly uglier, getting rid of the extra </p> around the <PRE>, but still readable:
perl -pe 'm|<pre>|..m|</pre>| and {m|</?pre>| or $_=qq|<p>$_</p>|} ' < + Your-file
Also removed the unnecessary empty para (per mortiz, and kept it XHTML-compatible !

     Have you been high today? I see the nuns are gay! My brother yelled to me...I love you inside Ed - Benny Lava, by Buffalax

Replies are listed 'Best First'.
Re^4: Substitution inside tags, as 1 line
by tel2 (Pilgrim) on Oct 16, 2008 at 01:20 UTC
    Thanks again NetWallah.

    Here are some more alternatives, based on yours, which generate the output I was after, including removal of the <pre> tags. I guess your code is more correct via web standards, though.

    perl -ne 'm|<pre>|..m|</pre>| and s/\n/<p>\n/;m|</?pre>| or print' htm +lfile perl -ne 'chomp;m|<pre>|..m|</pre>| and $_.="<p>";s|</?pre><p>|| or pr +int "$_\n"' htmlfile

    Thanks for your ideas.