ed & redirected input
funk at osiris.cso.uiuc.edu
funk at osiris.cso.uiuc.edu
Mon May 15 21:04:00 AEST 1989
If I have a script segment of the following form ....
site=<somevalue>
cmty=<someothervalue>
for i in file1 file2 file3
do
ed $i <<honker
1,\$ s/pat1/$site/g
1,\$ s/pat2/$cmty/g
w
q
honker
done
It works like a champ EXCEPT if one of the files (say file2) does NOT contain
an occurrence of pat1. Then ed proceeds to ignore everything else except the
q, (and it complains about not having seen a "w"), with the effect that the
file is NOT updated, even though it should have worked for the occurrences
of pat2. All other files are correctly updated, as they contain occurrences of
both pat1 and pat2. If I do it by hand, ed of course complains about the
no match, but still processes any subsequent commands.
I finally gave up and resorted to using sed into a temp file and moving the
temp file back to the original file. But it still leaves me wondering
HOWCUM????
I am working on a UNISYS 5000/80 running SYSTEM V, Rel 2.
-------------------------------------------------------------------------------
| Bruce Funk INTERNET: funk at osiris.cso.uiuc.edu |
|ACSEH, 21st TAACOM __________________________________________________|
|Kaiserslautern, W. Germany | Any resemblance between me and reality |
|(guesting on osiris) | is strictly coincidental |
-------------------------------------------------------------------------------
More information about the Comp.unix.questions
mailing list