[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: help on multiple search/replace



On Tue, Apr 11, 2000 at 12:31:02AM +0800, Chad A. Adlawan wrote:
> 
>   i dont know whether i successfully sent the first email i wrote.
>   anyway.

You did, and you got a few replies. Or else there's another Chad A.
Adlawan posting around here ;)

>   can someone please help me on writing a script or whatevers best in
>   order for me to perform multiple search and replace on thousands of
>   small files ?  that is, these small files contain (some doesnt) the
>   text "http://209.155.163.97/smile.gif"; and i want all of them to be
>   replaced with "http://www.cproda.com/smile.gif"; ...

A one liner (there may be better ways):
  find . \! -type d -exec perl -i -pwe 's!http://209\.155\.163\.97!http://www.cproda.com!g' {} \;

Run this in the root of the directory structure containing all the files
(e.g. if they're all under /usr/local/foo, you'd run it there)


-- 
  finger for GPG public key.

Attachment: pgpZGxuz9ME4l.pgp
Description: PGP signature


Reply to: