Character replacement script please?
Hi folks, I need to go through a whole tree checking every (html) file and replacing every instance of "\" with "/". Anyone got a ready made script? -- Best wishes, Derek Harding, (BA MIAP) ICT & Network Manager hardingd@warlingham.surrey.sch.uk
[Resent using a sender address the list likes :-) ] On Fri, 2001-09-21 at 10:23, Derek Harding wrote:
Hi folks,
I need to go through a whole tree checking every (html) file and replacing every instance of "\" with "/". Anyone got a ready made script?
find . -type f -name '*.html' -print0 | xargs --null \ perl -i.bak -pe 'tr:\\:/:' will leave the original files in filename.bak The -print0 to find, and --null to xargs mean that strange filenames with spaces etc would work too. Nigel.
On Fri, 2001-09-21 at 10:23, Derek Harding wrote:
Hi folks,
I need to go through a whole tree checking every (html) file and replacing every instance of "\" with "/". Anyone got a ready made script?
find . -type f -name '*.html' -print0 | xargs --null \ perl -i.bak -pe 'tr:\\:/:'
will leave the original files in filename.bak
The -print0 to find, and --null to xargs mean that strange filenames with spaces etc would work too.
With many thanks to Nigel - this seems to be what I need. -- Best wishes, Derek Harding, (BA MIAP) ICT & Network Manager hardingd@warlingham.surrey.sch.uk
participants (2)
-
Derek Harding
-
Nigel Metheringham