[Prev][Next][Index][Thread]
Re: a sed question...
On Mon, 17 Feb 1997 17:16:10 +0200 (IST), you wrote:
>On Mon, 17 Feb 1997, Alexandre Khalil wrote:
>
>> On Mon, 17 Feb 1997, Ira Abramov (at work) wrote:
>>
>> >cat 129.html | sed -e 'sg/.html/.htm/' > 129.htm
>>
>> sed -e 's/\.html/\.htm/' 129.html > 129.htm
>>
>> Would that work?
>
>AY KARRRAMBA! how could I be so blind? :-)
>
>ok, now for a trick question... all the html files on this site have the
>same bottom block of 10 lines or so of links to various points in the
>tree, and I want to remove that block and stick a single line for SSI
>
>in simple words: something like a block with
>
><hr size="2">
><center>
><h4>Further information on the home page:</h4>
><h5><a href="huard.htm">[ Home </a>
><a href="news.htm">| News </a>
><a href="about.htm">| About </a>
><a href="resr.htm">| Funding </a>
><a href="mesg.htm">| Messages </a>
><a href="scol.htm">| Scholarships & Exchang Progs </a>
><a href="ftp.htm">| FTP ]</a></h5>
>
>all exchanged for a single line saying:
><!--#include virtual="/bottom.raw" -->
>
sed won't help here because it is line oriented
but it is very simple with awk, which is also line oriented
but has variables:
$N=="<hr size=\"2\">" \
{ print "<!--#include virtual=\"/bottom.raw\" -->"; done = 1}
{if (done==0) print}
I assume here that <hr size="2"> only occurs at the beginning of
this block.
----
Moshe Cohen
Follow-Ups:
References: