views:

423

answers:

7

Searching for a free application for commercial usage that allows find/replace in multiple files (regular expressions are nice but not a must), that supports opening and saving in UTF-8.

Tried a few like BKReplaceEm but the application ends up saving all the files as ASCII which causes some problems with web-rendering.

Please advise.

Thank you!

[UPDATE] To further clarify, I am searching for a windows utility.

[UPDATE #2] This is going to be used to run through our 450 page site and replace all french characters with the much needed HTML entities.

+1  A: 

Use sed.

Thank you, is there a windows binary?
Dmitri Farkov
Sure. You can install http://www.cygwin.com/ but maybe there is a standalone version.
Sed is available from http://gnuwin32.sourceforge.net/packages/sed.htm, like most of the standard nix utilities.
RB
The rest can be found here : http://gnuwin32.sourceforge.net/packages.html
RB
Does sed allow searching in multiple files other than in the current directory? And can sed be plugged into some sort of GUI front-end easily? If not, I'd rather recommend using Perl - it can do 100% of what SED can do but is infinitely more powerful.
DVK
Good point, RB. I take a native binary over cygwin any day :-)
Joey
DVK: Sometimes you shouldn't use the biggest hammer you can get, just to put a tiny nail into a piece of wood :-)
Joey
You can always handle multiple files using a small script. If this script is written in shell, Perl, Python, Ruby, (insert your favorite scripting language) doesn't matter.
@Johannes - is that why all of my IKEA furniture has big hammer-shaped indentations? :)Seriously, Perl (aside from once-time overhead of installing it) is meant to be (and is as easy to use as), among other things, a drop-in replacement for both sed and awk.
DVK
A: 

jEdit has a feature called "HyperSearch" (just open the find dialog). You can specify a directory, a file name pattern and jEdit (being based on Java) does support lots of different encodings (and is often smart enough to figure out the correct one).

Aaron Digulla
+3  A: 

Notepad++ supports this feature, and is a great little editor in it's own regard.

Edit : Actually, Notepad++ does support replace in files. Click Search -> Find in Files, then select "Replace in files" in the dialog.

RB
Notepad++ supports FINDING in multiple files but it does not do such replacement. It makes you open each file from the list generated and then run Replace in Open Documents.
Dmitri Farkov
Except they don't even support lazy modifiers in their regex engine as I noticed today when trying to get something with `.*?` to match :/
Joey
Johannes : Dmitri said reg-ex would be nice, but not essential. Good to point out the limitations though.
RB
Dmitri : It does support replace in files - see my edit to my answer.
RB
Interesting which version are you running? I might be running an outdated version
Dmitri Farkov
Version 5.4.3 from June 7th, 2009 :-)
RB
No wonder, I am running version 4.1 Thank you! I rather use my default editor than any other app :)
Dmitri Farkov
+2  A: 

In the spirit of previous answer, you can use Perl (which has seamless native Unicode support and whose RegEx capablity are unparalleled). There are Windows perl versions avialable (ActivePerl, Strawberry, or you can use CygWin), and you can even slap GUIs on top of it -= for the latter, you can see what answers are given to my very recent So question :)

Plus, Perl can grab pretty much unlimitedly powerful collection of files, by using globs for simple things, File::Find for more complicated, and using grep on resulting file list to refine further if you need more fancy stuff, e.g. by content of modification time.

UPDATE For a Windows Editor, you can use UltraEdit. It has free evaluation period, and to be perfectly honest, I find the purchase price to be WELL worth paying for this very nice and powerful editor. Among its other features, it supports Unicode, and has pretty fancy search/replace ablities, including Perl RegEx support and S/R in multiple files.

DVK
A: 

You could try my editor, Code Trowel

If it doesn't do what you want I'd probably fix it :-)

Andrew Bainbridge
A: 

For windows, Notepad++ is awesome. It's licensed under the GPL. It does search and replace in files and does support regular expressions.

Mateo
A: 

You can use "CZ Find Replace" to find/replace in multiple files, and it supports opening and saving in UTF-8, you can get demo ersion and more information from http://www.convertzone.com/products/cz-find-replace.html

There is many find and replace tools in internet, but most of them can not handle utf-8 or unicode text right. Now, cz find replace can process utf-8 and unicode text files, you can download the trial version to try at once.

regards
flyaga

flyaga