9

I'm looking for a regular expression based search/replace GUI tool that is able to handle multiple files/subdirectories, something like grepWin but for Mac OS X.

PS. I'm aware of grep and I don't need an editor, just a standalone tool.

3
+150

Oh, I also just found this:

http://www.dprog.ch/home/products/find_and_replace_it/

About Find & Replace It!

A powerful search and replace utility. It allows performing very complex batch replacements inside text files of any size. It supports regular expression syntax and dozens of encodings. It has scripting capabilities which allow transforming on the fly the replacement text for every found string. It even handles batch processing of the encoding of files, as well as of types of end-of-lines.

Here are some key features of Find & Replace It!:

  • Find and replace across many files at once
  • Supports regexps
  • Supports many text encodings
  • Provides a regexp editor
  • Provides a find & replace preview
  • Offers a scripting interface that allows to transform replacement text on the fly
  • Many more features

It's developed by dProg - Philippe Docourt. I've never used it, so take this reccomendation with a grain of salt!

12

You're probably looking for a GUI app, but I can reccomend a terminal command. Perl can do inline replacement:

find . -type f -exec perl -p -i -e "s/SEARCH_REGEX/REPLACEMENT/g" {} \;

This will find all files under the current directory and replace based on the provided regexp. If you need to change directories, an easy way is to type: cd (be sure there's a space after) and then drag and drop a folder from the Finder onto the terminal window. Press return and you'll be in the folder you want; then run the perl command above.

If you want perl to make backup copies before replacing, run:

find . -type f -exec perl -p -i.bak -e "s/SEARCH_REGEX/REPLACEMENT/g" {} \;
  • 4
    any time I suggest Perl in a SO or SU answer I get downvoted without an answer. How it goes around here apparently. :) – Ian C. Mar 12 '10 at 16:11
  • @Ian: Maybe I should have used the ruby syntax? ;-) – Josh Mar 12 '10 at 16:13
  • 2
    imagine super users using perl regular expressions, that's crazy – mindless.panda Mar 16 '10 at 15:27
1

I understand that you don't need a full editor, but often the best tools are found within one. TextMate has full support for regular expressions and handles files and directories very well. Another that I haven't tried but heard good things about is TextWrangler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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