Free program to scan a directory of text files and replace certain strings

5

I need a free program that can scan all .xml files in a directory and replace a certain string occurrence.

JL.

Posted 2009-09-30T09:40:40.650

Reputation: 5 578

Answers

5

Assuming you use Windows, Windows Grep can do this! It's free.

Replacing as well as searching: Once you have performed a search you can change the matches found to another string in all files or a single file, quickly, easily and safely. In beginner mode, the Replace Assistant gently guides you through the process.

Snark

Posted 2009-09-30T09:40:40.650

Reputation: 30 147

the "windows grep" free version is supposed to be used for eval purpose. They encourage you to register! – anjanbacchu – 2011-07-22T14:21:07.923

Indeed. As any other find & replace software. I'd like to call the attention also to TextCrawler (http://www.digitalvolcano.co.uk/content/textcrawler) which includes a very(!) useful Regular Expressions Test Tool and a library of commonly used regular expressions.

– A Dwarf – 2009-09-30T09:51:38.787

Does not work for binary files. Sometimes files automatically written out as .csv are treated as binary files in Windows Grep and it fails miserably when trying to replace text in them – user48930 – 2013-01-29T06:35:03.840

3

Use sed:

find /dir -type f -exec sed -i 's/old/NEW/g' {} \;

Andrejs Cainikovs

Posted 2009-09-30T09:40:40.650

Reputation: 2 611