[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev TRST : awk script
From: |
Philip Webb |
Subject: |
Re: lynx-dev TRST : awk script |
Date: |
Tue, 9 Nov 1999 06:06:34 -0500 (EST) |
i haven't read the latest messages yet, but here's an awk script
(with sed annexe), which performs the same deletions of <P>, </P> & <BR>
which i did by hand in www.chass.utoronto.ca/~purslow/trst.html
(there's no <BR> there, but other tests suggest it works);
it does assume < & > alternate, but otherwise seems robust.
to try it out, run the script on an HTML file of your choice;
disclaimer: awk & sed may perform differently on different systems.
i hear the jackals howling & see the hyenas slavering ...
awk 'BEGIN { FS = "<" ; u=0 }
$0 == "" {print $0}
$0 != "" {for (i=1; i<=NF; i++) {
t=0;
if ($i ~ /^[Tt][Aa][Bb][Ll][Ee].*>.*/) u=u+1;
if ($i ~ /^\/[Tt][Aa][Bb][Ll][Ee]/) {u=u-1; if (u<0) u=0};
if (u>0 && ($i ~ /^[Pp]/ || $i ~ /^\/[Pp]/ || $i ~ /^[Bb][Rr]/ ))
{o=">"; split($i,a,o); printf "#####"; printf "%s", a[2]; t=1};
if (t==0) {
if ($i ~ />/) printf "<";
printf "%s", $i }}; printf "\n" }
' $* |
sed 's/#####//g
'
[NB the final ' ]
--
========================,,============================================
SUPPORT ___________//___, Philip Webb : address@hidden
ELECTRIC /] [] [] [] [] []| Centre for Urban & Community Studies
TRANSIT `-O----------O---' University of Toronto
- Re: lynx-dev TRST: the next step, (continued)
- Re: lynx-dev TRST & lynxcgi, Philip Webb, 1999/11/08
- Re: lynx-dev TRST & lynxcgi, Klaus Weide, 1999/11/08
- Re: lynx-dev TRST & lynxcgi, Philip Webb, 1999/11/08
- Re: lynx-dev TRST & lynxcgi, Klaus Weide, 1999/11/08
- Re: lynx-dev TRST & lynxcgi, Philip Webb, 1999/11/08
- Re: lynx-dev TRST & lynxcgi, Klaus Weide, 1999/11/08
- Re: lynx-dev TRST & lynxcgi, Philip Webb, 1999/11/08
- Re: lynx-dev TRST & lynxcgi, Vlad Harchev, 1999/11/09
- Re: lynx-dev TRST & lynxcgi, Vlad Harchev, 1999/11/09
- Re: lynx-dev TRST : awk script,
Philip Webb <=
- Re: lynx-dev TRST : diff versions of awk & sed: USE GNU!, David Combs, 1999/11/09
- Re: lynx-dev TRST : use the printer, stupid!, Philip Webb, 1999/11/10