How to mass Search & Replace in text files.

Alex Beamish talexb-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Fri May 1 14:29:27 UTC 2009


On Fri, May 1, 2009 at 10:26 AM, Lance F. Squire <lance-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org> 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?

The classic tool for doing this is sed .. but you could also use perl
-ie 's/Bad JS//' *.html

-- 
Alex Beamish
Toronto, Ontario
aka talexb
--
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