[comp.unix.questions] Delete the hold space in sed?

david@wubios.wustl.edu (David J. Camp) (11/20/90)

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@wubios.wustl.edu             ^     Mr. David J. Camp
david%wubios@wugate.wustl.edu    < * >   +1 314 382 0584
...!uunet!wugate!wubios!david      v     "God loves material things."