[oclug] tr help
Stephen M. Webb
stephen.webb at bregmasoft.com
Fri Nov 14 15:47:55 EST 2003
On Friday, November 14 2003 15:19, Bob Lockie wrote:
>
> Can I even use tr to output the same file that it inputs?
No.
> What I need to do is go through all some HTML files and change "\" to "/".
> Something (MS Word maybe) created some links that use "\" as directory
> seperators and Apache uses "/" so I have paths that are a mix of "\" and
> "\" when the page loads and therefore some things are broken.
>
> I was thinking of doing something like this (but that works):
> find . -name \*.html -exec tr "\\" "\/" < {} > {} \;
try something like (off the top of my head)
for file in `find . -name \*.html`; do
mv $file $file.backup
tr '\\' '/' <$file.backup >$file || rm $file.backup
done
--
Stephen M. Webb
stephen.webb at bregmasoft.com
More information about the OCLUG
mailing list