How to mass Search & Replace in text files.
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Fri May 1 17:45:48 UTC 2009
On Fri, May 01, 2009 at 10:26:16AM -0400, Lance F. Squire wrote:
> One of the sites on my server has been infected with some malicious Java
> Script.
>
> I can locate all the files with:
>
> grep "Bad JS" `find . -name "*.html"`
>
> Is there a way to modify this to replace the "Bad JS" with ""?
>
> Or a find variant?
How about:
find . -name "*.html" | xargs perl -pi -e 's/BAD JS//'
I didn't test it, but it looks OK to me.
--
Len Sorensen
--
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