How to mass Search & Replace in text files.
Lance F. Squire
lance-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Fri May 1 16:27:57 UTC 2009
D. Hugh Redelmeier wrote:
>
> Your question about recursive searching shows that you haven't got a
> good internal model about how the shell ecosystem works.
>
Is it showing!... ;)
I have only used shell to do basic file moves/renames and launching
other programs.
> If you want recursion, you generally have to use find(1). The latest
> BASH (which you probably don't have) adds ** for this purpose.
>
Thought so, but doesn't hurt to ask. (much... :) )
> Here's a guess. Untested. Any bug might be very destructive.
>
> find /root/of/tree/with/html -name '*.html' -print0 \
> | xargs --no-run-if-empty --null sed -i -e 's/BadJS//g'
>
So far the make-up of the JS has foiled my attempts at 's/JS//'.
I tried manually \ escaping the JS in a perl script, to no avail.
As this script is between the </head> and <body> tags, can we say
'everything between'?
> Notes:
>
>
> - are you sure that this is all the damage that needs fixing?
> Proving that would seem tough and a mistake might be bad.
All the files are (supposed to be) raw html. No scripts etc.
Lance
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list