* Cameron Simpson
>
> I tend to do this:
>       find dir -type f -name '*.html' -exec bsed 
> 's|this|long/thing/with/slashes/this|g' {} ';'
> or just:
>       bsed 's|this|long/thing/with/slashes/this|g' *.html
> for just the .html files in the current directory.

As far as I understood the question, you have to replace relative
addresses with correct absolute ones.  This means some intelligence in
the 'long/thing/with/slashes/' thing.  E.g. like this:

HTML_DIR=/var/www/html
PREFIX=http://www.thesite.com
for f in $(find . -type f -name '*.html'); do
  CPRE=${PREFIX}${f#$HTML_DIR}
  SEDSTR='s/action="\([^"]*\)/action="'$CPRE'\1/g'
  sed "$SEDSTR" <$f >$f.new
done

-- 
 Jon Haugsand, [EMAIL PROTECTED]
 http://www.norges-bank.no


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to