From: Lars Hecking (lhecking at domain nmrc.ucc.ie)
Date: Mon 23 Aug 1999 - 12:43:27 IST
> THE PROBLEM
> The problem is that I am currently in the process of switching web servers.
> (Going with apache) Now the problem is that all the web pages have server
> specific tags in the html. These do not work under apache and I don't want
> them to either. Now what I want to do is one of the following:
> 1. I could leave the specifc tags alone and just write in my own (in this
> case I am call a ssi <!--#exec cmd="/path/to/command"--> that would be fine
> except I need to delete one line from all the files and add the above ssi
> tag. How do i do this with with a web site that has about 10,000 to 35,000
> documents.
If the tag is the same in all documents:
$ for i in `find /foo/bar -name '*.html' -print` ; do mv ${i} ${i}.bak ; \
sed 's,tag,replacement,g' ${i}.bak >${i} ; rm -f ${i}.bak ; done
If not all documents need to be processed, one could wrap an
if grep 'tag' ${i} >/dev/null 2>&1 ... fi
around the mv ... sed ... rm ... sequence.
If the tag contains a number of different special characters, it may be
necessary to do the processing in more than one step, or even use
temporary placeholders
... sed -s 's,xxx,yyy,g' -e 's,zzz,ttt,g' -e "s,yyy,uuu,g'
If the tag is different in different files, it gets more complicated,
and others might suggest perl ...
You can email me directly if you need more help.
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:29 GMT