Page 1 of 1

command prompt interface for find & Replace

Posted: Thu Jun 02, 2011 3:25 pm
by Frank_CM2738
I need to edit a file on the fly within a batch file to find and replace text at a command line prompt. Can this be done in TextPad and how?

Here is what I am looking to do:

For Example:

Change.bat:

third_party code.exe outfile.txt

textpad /open=outfile.txt /replace="ncc=1701d","NCC-1701D" /save = outfile.txt

Posted: Thu Jun 02, 2011 3:59 pm
by ben_josephs
Why use a GUI program for a command-line task?

There are many free command-line text-processing tools available on the web.

A suitable standard utility for this job is sed, which you can download from, for example,
http://gnuwin32.sourceforge.net/packages/sed.htm

Try something like this:
sed "s/ncc=1701d/NCC-1701D/g" infile.txt > outfile.txt