On 2/13/07, Ralph Shumaker <[EMAIL PROTECTED]> wrote:

Now, is there a way to do these kinds of substitutions via a script? In
other words, can I create a script file that I can just add new
substitution commands, execute the script, and it run anew on the
original, each time outputing to an output file?

Basically, I want to figure out as I go, what all substitutions need to
be made to the original, but without continuing to change the output,
and change the output, and change the output. I don't mind that the
script would be repeating what it's already done. But if I add a new
substitution command, I want it (and all its predecessors) executed upon
the original each time. When I'm done, the script will show exactly what
changes were made between the original and the result. (I will continue
to test each new substitution within vi before I add it to the script.)

This is what sed (stream editor) was created for.  To run from a
script of editor commands and apply them sequentially to the input
text file.

Sed has a lot of control structure commands which you probably don't
need.  Read the manual page and just look mostly at the
s/regexp/replacement/ section and the section on addressing.  This is
basically what you have worked up to in vim, but running from a script
rather than keyboard input.

   carl

--
   carl lowenstein         marine physical lab     u.c. san diego
                                                [EMAIL PROTECTED]


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to