Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking to find / replace in alot of files and was wondering if anybody could recommend some good tools for Windows. I'd prefer them to be free.


share|improve this question

closed as off-topic by Falcon Momot, Jenny D, Bryan, Scott Pack, mdpc Jul 20 '13 at 6:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve." – Falcon Momot, Jenny D, Bryan, Scott Pack, mdpc
If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 8 down vote accepted

This is what I use:

for GUI grepWin: link text

for superfast commandline: gsar.exe from link text

share|improve this answer

Install Cygwin, its free and gives a linux-like scriptable environment in Windows.
Do lookup the manual pages for commands I describe here (man find for example).

List files in a directory (folder) with,

find . -type f  
## Note: you can also select files here (see the man page)

Use that to search in multiple files like this,

grep -Hn pattern $(find . -type f)

Use it to replace across files like this.
Create a script file (say)
Write the following in the file,

# Sample script:
for f in $(<find . -type f);
    sed 's/pattern/replacement/g' $f > tmpFile.txt
    mv tmpFile.txt $f;
rm -f tmpFile.txt

tmpFile.txt should be some temporary name (not already existing in the directory).
And, pattern is the regex you want to change with replacement.
Execute chmod a+x and the file becomes an executable that you can fire from a Cygwin terminal with ./

You can build up for there for many other requirements.
To lookup manual pages for commands like sed, find, grep you can also google "manual sed" etc.

The Advanced Bash Scripting guide at the Linux Documentation Project site is a good reference and most of the concepts work under Cygwin. Also has Awk, sed, briefs at the end.

share|improve this answer

Whilst probably not as fast as the above options - Notepad++ has a good find/replace with RegEx support.

share|improve this answer

I would go with Cygwin. If this is not desirable, on you can find a bunch of standalone GNU utilities like sed, grep and find ported to Windows.

share|improve this answer

I've been using Text WorkBench for a while now and think it's fantastic. It's got lots of useful features including batch replace plans, regular expressions, include/exclude file extensions, editing files inside the application, etc.

Not free though... Think it costs about $40, but is easily worth it given the amount of time it saves. I'm not affiliated with the company in anyway, just a happy customer.

share|improve this answer
-1 Shareware, Richard asked for freeware – mate64 Jun 3 '13 at 10:25
@cept0 Not quite. The exact words in the question are "I'd prefer them to be free" (emphasis mine). – Mun Jun 3 '13 at 20:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.