Re: Question on how to do a global search and replace
From: Barry Margolin (email@example.com)
From: Barry Margolin <firstname.lastname@example.org> Date: Tue, 08 Apr 2003 21:41:11 GMT
In article <3E93362D.6ACC0F61@producer.com>,
Reynold Mark <email@example.com> wrote:
>Hi all. I've looked in the archives for this problem and have tried
>quite a few different suggestions but so far, no luck. I'm trying to do
>a search and replace for a specific web address and changing it to a
>different web address. The problem is that this particular string is in
>thousands of files and may show up many times within one file. I want
>to be able to issue a command that will replace all those entries with
>the new entry. The files exist in many directories and subdirectories
>on the hard drive.
>The types of problems I ran into so far is that some files will take the
>change, but not all of them. Or it will replace some of the entries in
>one file but leave out an entry in the same file. Sounds strange but
>Any ideas on what I can use to do this? We're running Solaris 9 on an
>Ultra 10. Thanks.
find top-dir -type f -print | xargs perl -pi -e 's;oldURL;newURL;g'
-- Barry Margolin, firstname.lastname@example.org Genuity Managed Services, a Level(3) Company, Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.