DonationCoder.com Software > Finished Programs
SOLVED: Recursive Search and Replace in Nested Folders
nkormanik:
Installed without any problem. Thanks.
As anticipated, in the programs tried so far, can't figure out how to put in a TAB character. They seem to be geared for regular text.
x16wda:
If you can stand a command line, the C-style option below might work. I've used this one and gsar.exe both in various batch processes, can't recall offhand now why I needed both of them... maybe one of them didn't want to replace in place? hmm... <walking off muttering to himself...>
--- Code: Text ---Find And Replace Text v1.99b by Lionello Lunesu Usage: FART [options] [--] <wildcard>[,...] [find_string] [replace_string] Options: -h, --help Show this help message (ignores other options) -q, --quiet Suppress output to stdio / stderr -V, --verbose Show more information -r, --recursive Process sub-folders recursively -c, --count Only show filenames, match counts and totals -i, --ignore-case Case insensitive text comparison -v, --invert Print lines NOT containing the find string -n, --line-number Print line number before each line (1-based) -w, --word Match whole word (uses C syntax, like grep) -f, --filename Find (and replace) filename instead of contents -B, --binary Also search (and replace) in binary files (CAUTION) -C, --c-style Allow C-style extended characters (\xFF\0\t\n\r\\ etc.) --cvs Skip cvs dirs; execute "cvs edit" before changing files --svn Skip svn dirs --remove Remove all occurences of the find_string -a, --adapt Adapt the case of replace_string to found string -b, --backup Make a backup of each changed file -p, --preview Do not change the files but print the changes
nkormanik:
Nice job copying all those options. Command line is fine. Whatever gets the mission accomplished. Thanks a lot.
Two programs so far do allow for TAB. So, all this help has been well worth it.
MilesAhead:
Esp. with raw substitution this kind of filtering is ideal for sed stream editor. Only hassle is it's a Linux command. But you may find binary Windows ports. All you need is something that searches every file for the target character, such as grep and when you find a hit, you pipe it into sed.
In fact the Windows port of the find command will do it. Depends how much of this type of thing you need to do. If these types of tasks pop up all the time it may be worth setting up a Linux shell like bash that natively handles Linux command line binaries ported to Windows.
There are dozens of sed "one liners" you can find on the web that can do quite a bit when it comes to substitutions.
For a one-shot it's not worth it though. :)
skwire:
@Nick: Please let me know if/when you have a working solution and I'll mark this thread as solved and move it. Thanks! ;)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version