Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Komodo Edit (activestate.com/komodo-edit) has a "Find/Replace In Files" feature. Its a free editor for Mac, Windows and Linux. –  jsherk Apr 4 '13 at 20:40

4 Answers 4

up vote 2 down vote accepted
+150

Oh, I also just found this:

http://www.apple.com/downloads/macosx/development_tools/findreplaceit.html

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!

share|improve this answer
    
thanks......... –  user187291 Mar 16 '10 at 17:30

I'm looking for that as well. I don't remember the name of the tool I used on Windows, was it "Search and Destroy"? It had a nice GUI and could make search and replace operations on file hierarchies.

EDIT: That's heavyweight.. but Eclipse is a good option. I'm not sure if that's part of the Aptana plugin for Eclipse, but there is also a full preview, of the operation, with changes in each file, and you can check/uncheck any file before confirming the operation. I just wish there was something else to fire up those times I hang out in MacVIM :)

The command line/Terminal tools are a pain to use, the regular expression engine is the older style if I'm not mistaken, and you have to escape a lot of characters, on top of those you already have to escape in a normal regular expression. No good preview or feedback mechanism either.

PS: see similar topic, "Must have Search/Replace tools for text files".

share|improve this answer

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" {} \;
share|improve this answer
2  
I'd love to know why I was downvoted so I could correct any issues with my answer... –  Josh Mar 11 '10 at 2:00
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

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.

share|improve this answer
    
+1 for TextWrangler - I use its big brother, BBEdit, for search and replace, diff, etc. –  Paul R Mar 2 '10 at 17:54
    
thanks, i'm already using Textmate and it's awesome, but not as a search-replace tool. "Why isn’t there a damn stop button?!!" (blog.johnjosephbachir.org/2007/10/01/…) ;)) –  user187291 Mar 2 '10 at 22:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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