[thelist] Search & Replacer

Anderson Cummins acummins at rogers.com
Sat Jan 11 14:57:24 CST 2003


Allready covered.

Try
1) cp -R dir_name backup_dir
2) perl -spi.bak -e 's/Old String/New String/gi' dir_name/*.html
All the old files are save with the .bak extension, you can remove them or
even skip
step 1 and work from your .bak files.

To recover
mv backup_dir dir_name or use perl to rename the files

You can fiddle with it but that's the gist.
(synthax may be a bit off but the man page is correct :-)
Thanks,
AC

----- Original Message -----
From: "Dave Denis" <dave at davedenis.com>
To: <thelist at lists.evolt.org>
Sent: Saturday, January 11, 2003 2:34 PM
Subject: Re: [thelist] Search & Replacer


> The problem with this though is that there is no undo.  Depending on how
> familiar the user is with crafting a regex this might be an important
thing.
>
> Dave
>
> Hassan Schroeder wrote:
> > Kevin W wrote:
> >
> >> My personal site is a bunch of HTML files and it's getting a bit big.
> >> Does
> >> anyone have suggestions for a program or Perl script to search/replace
> >> through the files?  Preferably with regex and either a file-picker GUI
or
> >> support for DOS (or similar) wildcards.
> >
> >
> > Combine `find` (the *nix, not DOS version) with Perl's edit-in-place
> > flag and you're there. No GUI, of course, but that's a feature, not
> > a bug :-)
> >
> > --
> > Hassan Schroeder ----------------------------- hassan at webtuitive.com
> > Webtuitive Design ===  (+1) 408-938-0567   ===
> >
> >                           dream.  code.
> >
> >
> >
>
> --
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !




More information about the thelist mailing list