Delete the hold space in sed?

David J. Camp david at wubios.wustl.edu
Tue Nov 20 13:11:22 AEST 1990


I am trying to write a sed program, and I cannot figure out how to 
delete the hold space.  I tried:

    /$PATTERN/{s/.*\n//;h;}

but this fails in some cases, in particular when the search pattern
is:
    /.*/

In that case, the /.*\n/ pattern fails, and the pattern space is
copied to the hold space.  It works when the search pattern is
a simple upper case alphabetic string.

Can anyone suggest a good way to do this?  Thank you,  -David-

david at wubios.wustl.edu             ^     Mr. David J. Camp
david%wubios at wugate.wustl.edu    < * >   +1 314 382 0584
...!uunet!wugate!wubios!david      v     "God loves material things."



More information about the Comp.unix.questions mailing list