Re: Question on how to do a global search and replace

From: Barry Margolin (barry.margolin@level3.com)
Date: 04/08/03


From: Barry Margolin <barry.margolin@level3.com>
Date: Tue, 08 Apr 2003 21:41:11 GMT

In article <3E93362D.6ACC0F61@producer.com>,
Reynold Mark <reynold.mark@producer.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
>true.
>
>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, barry.margolin@level3.com
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.


Relevant Pages

  • Question on how to do a global search and replace
    ... I've looked in the archives for this problem and have tried ... quite a few different suggestions but so far, no luck. ... Or it will replace some of the entries in ... one file but leave out an entry in the same file. ...
    (comp.unix.solaris)
  • The "Cape Cod Bob" 2010 Pick The Divisions Contest
    ... Good luck to all this year. ... I usually get 3-4 entries that are missing a team and/or have the same team listed twice. ... I will reply to every entry so you know I received it. ... For instance, if Toronto and New York tie for second, then you are okay by picking them second or third. ...
    (alt.sports.baseball.bos-redsox)
  • The "Teddy Zartler" 2009 Pick The Divisions Contest
    ... Good luck to all this year. ... Please review your entries carefully before submitting. ... I will reply to every entry so you know I received it. ...
    (alt.sports.baseball.bos-redsox)
  • We have 2 copies of HARD HOUSE ANTHEMS to giveaway!
    ... How many tracks are on HARD HOUSE ANTHEMS? ... Email your entry to tony@xxxxxxxxxxx Please include your name, ... We'll pick a winner from all entries on 06th ... January 2009 Good Luck! ...
    (uk.rec.competitions)
  • Re: Solving the lib mismatch problem
    ... This section is pointed to by an entry in the section table with the ... The number of entries in the table is determined by DT_VERDEFNUM. ... This is an index into the string section referenced in the section ... Offset in the string section reference by the link in the section ...
    (comp.unix.programmer)