# Find and Replace Text Across Multiple Files?



## cgp314 (Jan 6, 2005)

I have a load of HTML files I need to make identical changes to.  There are far too many to do it manually, so I was wondering if anyone knows of grep-like command that I can use to find and replace text across multiple files.

Thank you in advance for your help,

-Colin


----------



## Pengu (Jan 6, 2005)

um... why not grep?

or. try skEdit.


----------



## cgp314 (Jan 6, 2005)

Pardon my ignorance, but I thought grep was only able to match text strings in files, not replace them.


----------



## brianleahy (Jan 6, 2005)

It's a bit of overkill, but the XCode editor will do it.


----------



## Arden (Jan 6, 2005)

Find the (discontinued) version of BBEdit Lite and use its multifile search capabilities.  It even supports grep.


----------



## quiksan (Jan 6, 2005)

MassReplaceIt (at VersionTracker)
Actually, the 2.0 version is here:
http://www.hexmonkey.brownhost.com/  (versiontracker is apparently out of date...)

lets you select the files you want to search, and set the text you want to search for and tehn replace.  even tells you teh docs and the number of changes to each doc before you apply the replace.

very cool.  
UI is very minimalistic, but it's not hard to figure out.


----------



## Cat (Jan 7, 2005)

Isn't awk also good enough?

If you have a lot of identical text/code in your (X)HTML perhaps you should consider using PHP (make files with the identical text and include them via PHP in your pages).


----------



## lackluster (Jan 8, 2005)

use Perl;

If it's a simple change maybe you can post it here, and we can work out a one-liner. Otherwise, I'd say your best bet is to spend a few hours learning Perl (it pays off in the end).


----------

