ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Simple free commandline text search and replace tool?

<< < (3/4) > >>

f0dder:
I was just wondering :) - DOS programs have a disadvantage running under windows since they need some virtualization... and won't run at all under 64bit windows (outside of full emulation, like dosbox). I still use plenty of console applications, but it's been several years since I've used anything 16bit. Seems like the 32bit version is DJGPP, no wonder it's quirky on NT based operating systems then :)

Rover:
I have used this before and found it more than adequate.  :Thmbsup:

GSAR:  GSAR Project Page

gsar (General Search And Replace) is a utility for searching for and --- optionally --- replacing strings in both text and binary files. The search and replace strings can contain all kinds of characters (0--255), i.e. Ctrl characters and extended ASCII as well.

The algorithm used is a variation of the Boyer-Moore search algorithm, modified to search binary files. As a result of this, gsar is blindingly fast.

Opposed to line oriented search programs (like grep(1)), gsar will find all matches on a line. Actually, gsar doesn't know anything about lines at all, all files and strings are treated as binary.

Gsar can search one or several files for a string and report the occurrences. Gsar can read one file, search for a string, replace it with some other string, and create a new file containing the changes. Gsar can perform a search and replace in multiple files, overwriting the originals. Finally, gsar can work as a filter, reading from standard input and writing to standard output.
--- End quote ---

rjbull:
I have used this before and found it more than adequate.  :Thmbsup:

GSAR:  GSAR Project Page
-Rover (December 01, 2008, 01:46 PM)
--- End quote ---

I'd forgotten that one, even though I still use the DOS version - and it's a good one, too.  But again, unless they've updated it, it will only do one search/replace pair at a time.  When I wanted multiple pairs to use as a user-defined tool in TED Notepad and in ClipboardHelp+Spell, I ended up using SED.

skas:
Why not use something like GNU grep? It's strictly command-line, and it can be set for silent mode too. Download and/or read documentation at: <http://www.gnu.org/software/grep/>

But if you want an app that provides an easy-to-use GUI for building & saving sets of search-replace operations -- which you can then call from a command-line -- consider BK ReplaceEm.

This 32-bit Windows freeware application hasn't been supported or distributed by its developer Bill Klein (BK) for a number of years. But it was once considered among the very best search-n-replace apps (free or not). And I think it still deserves such consideration.

For a rather complicated example of the very sort which originally inspired BK to create his application, see: <http://www.ccp14.ac.uk/ccp14admin/bkreplacem/index.html>.

But the download URL on the latter webpage is dead. To download it, you must use an archive website like SnapFiles: <http://files.snapfiles.com/localdl834/bkrep20.exe>.

It's a very safe program to install & try -- it just puts its files in a single folder w/o any changes to the registry, as I recall.

With BK ReplaceEm, you use replace groups and file sets.

A replace group consists of a series of search & replace strings (regular expressions & 'range replacements' are supported, and any series of simple boolean operations can be input & saved via the GUI too).

A file set consists of a single file, multiple files, or a whole directory  -- perhaps filtered by particular file extensions. Whatever.

You can have the program create a backup copy of every file it operates on, in case things don't go as you expected.

You can have the program output to different locations too. And if you want, you can set the application to run additional -- and different -- replacement operations on all files found in that second location. Logs can be generated too.

I hope that's an accurate description. It's a been a while since I've used it. I invested in the very expensive TextPipe Pro a couple years ago, which, I think is the application BK ReplaceEm most resembles.

BTW, anyone interested in search & replacement operations would be well-served by Friedl's book, 'Mastering Regular Expressions', now in its 3rd edition from O'Reilly. I'm not a programmer, but this book has helped me greatly in parsing & editing text, in website development & maintenance, even in finding & managing files on my desktop PC -- all via the numerous applications that now support Perl & other varieties (like grep) of regular expressions.

Steve

rjbull:
But if you want an app that provides an easy-to-use GUI for building & saving sets of search-replace operations -- which you can then call from a command-line -- consider BK ReplaceEm.
-skas (December 02, 2008, 07:58 AM)
--- End quote ---

I looked through BKReplacem's command line options a while back, and didn't really understand them   :-[  So I went with SED.  It's case-sensitive, but that was OK for what I wanted.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version