8

I am looking for a Windows tool (exe) or Python script which can be used on the command line to search and replace strings in text files recursively in a source code tree. I am trying to avoid the custom syntax of sed/awd like linux tools. It needs to be automated, therefore it needs to be command line.

Any suggestions?

5 Answers 5

2

I think WinGrep may meet your needs. I believe it can be run from the command line. Link: www.wingrep.com

1
  • Note that this product no longer exists. May 1, 2017 at 20:17
1

A little pricey, but PowerGrep has a command line interface or so the manual says.

1

There is fnr.exe, which is a lightweight utility that supports command line. It doesn't have as many features as grep, but it makes it easy to generate command line script by providing all the parameters in windows form. It is available from here: http://findandreplace.codeplex.com

0

NotePad++ worked great. Free add-in. Search - Find in files...

0
0
sed -i%TEMP%\* "s/regexp/replacement/g" *.txt

Backup files will be in temp directory. Sed can be easily downloaded with chocolatey: https://chocolatey.org/packages/sed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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