0

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.

[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.

Nick Ginanto
  • 31,090
  • 47
  • 134
  • 244
Dmitri Farkov
  • 9,133
  • 1
  • 29
  • 45
  • Dmitri - could you please clarify if your multiple files will be 100% in a single directory? Thanks – DVK Sep 21 '09 at 15:14
  • 1
    Why are HTML entities even needed? Wouldn't the correct solution be to advertise the correct character set? – Joey Sep 21 '09 at 15:15
  • The files are all in one directory BUT they are contained in a variety of sub-folders of the such. So I guess no. – Dmitri Farkov Sep 21 '09 at 15:47
  • Well, the only point in using HTML entities is to include them in HTML files which either have no or varying character set declarations. If both points do not apply, then mayhaps it's even easier to let the HTML files use the proper encoding which eliminates such character encoding issues pretty nicely. – Joey Sep 21 '09 at 15:51
  • Um. If you're replacing all non-ASCII characters with HTML entities, then whether the result is saved as ASCII or UTF-8 is moot - it's exactly the same byte representation either way. If there's any difference, then I have to wonder why you're replacing French characters with html entities, but leaving Spanish, German, Chinese, Japanese, and Klingon characters as UTF-8. – Steve Jessop Sep 21 '09 at 16:02

6 Answers6

3

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.
  • 36,301
  • 12
  • 91
  • 131
  • 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 Sep 21 '09 at 15:10
  • 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 Sep 21 '09 at 15:10
  • Johannes : Dmitri said reg-ex would be nice, but not essential. Good to point out the limitations though. – RB. Sep 21 '09 at 15:13
  • 1
    Dmitri : It does support replace in files - see my edit to my answer. – RB. Sep 21 '09 at 15:14
  • Interesting which version are you running? I might be running an outdated version – Dmitri Farkov Sep 21 '09 at 15:18
  • Version 5.4.3 from June 7th, 2009 :-) – RB. Sep 21 '09 at 15:25
  • No wonder, I am running version 4.1 Thank you! I rather use my default editor than any other app :) – Dmitri Farkov Sep 21 '09 at 15:31
2

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.

Community
  • 1
  • 1
DVK
  • 126,886
  • 32
  • 213
  • 327
1

Use sed.

  • Thank you, is there a windows binary? – Dmitri Farkov Sep 21 '09 at 15:05
  • Sure. You can install http://www.cygwin.com/ but maybe there is a standalone version. –  Sep 21 '09 at 15:06
  • 3
    Sed is available from http://gnuwin32.sourceforge.net/packages/sed.htm, like most of the standard nix utilities. – RB. Sep 21 '09 at 15:09
  • 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 Sep 21 '09 at 15:13
  • 2
    Good point, RB. I take a native binary over cygwin any day :-) – Joey Sep 21 '09 at 15:14
  • 1
    DVK: Sometimes you shouldn't use the biggest hammer you can get, just to put a tiny nail into a piece of wood :-) – Joey Sep 21 '09 at 15:14
  • 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. –  Sep 21 '09 at 15:15
  • @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 Sep 21 '09 at 15:19
0

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
  • 321,842
  • 108
  • 597
  • 820
0

You could try my editor, Code Trowel

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

Andrew Bainbridge
  • 4,651
  • 3
  • 35
  • 50
0

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

Mateo
  • 1,781
  • 1
  • 16
  • 21