SLUG Mailing List Archives
[SLUG] batch text editting
- To: slug@xxxxxxxxxxx
- Subject: [SLUG] batch text editting
- From: Daniel Freedman <freedman@xxxxxxxxxxxxxxxx>
- Date: Sat Oct 21 17:34:24 2000
- Cc: freedman@xxxxxxxxxxxxxxxx
I'm looking to do some batch text editing by applying the changes I make
to one file to many other similar (although not identical) files. The
text portions I'm changing in the first file, however, ARE in fact
identical in the other files.
I was thinking of doing a context diff and then a patch, but I don't think
I can easily edit the context diff such that, upon patching, it will only
patch certain areas (I know the patch is wise to its context, it's just
that I don't think i can easily alter the patch itself before applying,
because its embedded line numbers would have to be changed to account
for my edits in the patch).
I also tried to do a diff -e (to produce some patchfile 'p' to feed to
ed), then hand-edit 'p', then invoke:
(cat p; echo '%p') | ed - orig > new
This should work better, I think, since it reverse lists the changes to
somewhat avoid the line numbering problem. It is, in fact, working in
some cases, but when the hand-editing of the patchfile is more involved,
it's not very graceful. I list an example below.
Am I missing something here, please? Is there a better way to do this
(I'm sure there is)?
Thanks for any and all suggestions... I really appreciate your help.