D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Mass editing text files?

 

On Friday 27 July 2007 12:25, Jonathan Roberts wrote:
> > I got a bit of a shock finding that there is so little DOM processing
> > stuff server side!
> > I wrote a web site tidier upper using MS.NET and IE plugin for a job I
> > had - give it a site URL and it would go over the whole site and find
> > errors of all kinds  and even run TIDY to generate a cleaned up version,
> > stuck it on sourceforge ..
> > And Nobody Came!
>
> Lol, before your time perhaps :p
Wot annoyed me was I wrote it as part of my job tidying up a council website - 
all government stuff has to be accessible etc and there are several thousand 
websites out there being tidied up by contractors etc for a large fortune and 
they were all 'locked in' to pissing that money up the wall!
>
> In the end I've got it to work using a shell script, in case any body
> is interested:
>
> #!/bin/sh
>
> for i in `find */*.shtml` ; do
>       cat $i | sed -e '/<head>/a\ <!--#include
> virtual=\"http:\/\/www.cis.org.uk\/includes\/google.html\" -->' >
> tmp.txt
>       cat tmp.txt > $i
>       rm tmp.txt
> done
>
> Worked recursively too so it did exactly what I needed :D
Nice one! Now I can add style sheets to some of my badly setup sites with 
ease!
Tom te tom te tom



-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html