command prompt interface for find & Replace

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
Frank_CM2738
Posts: 1
Joined: Thu Jun 02, 2011 3:12 pm

command prompt interface for find & Replace

Post 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
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post 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
Post Reply