Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site delftcc.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!pyramid!pesnta!phri!delftcc!sam From: sam@delftcc.UUCP (Sam Kendall) Newsgroups: net.bugs.usg Subject: Re: Bug in sed(1)? Message-ID: <120@delftcc.UUCP> Date: Fri, 24-Jan-86 21:30:31 EST Article-I.D.: delftcc.120 Posted: Fri Jan 24 21:30:31 1986 Date-Received: Sun, 26-Jan-86 17:07:56 EST References: <685@ttrdc.UUCP> Organization: Delft Consulting Corp., New York Lines: 24 Summary: A simple workaround In article <685@ttrdc.UUCP>, levy@ttrdc.UUCP (Daniel R. Levy) writes: > I have encountered what I THINK is a bug in sed(1).... > > Specifically, it involves expressions of the form '1,/^fixed_pattern$/d'.... > > Unfortunately, this seems to fail when the first line of the input exactly > matches fixed_pattern; then, instead of only the first line of the input > being discarded, ALL the lines of input are discarded. As another news item noted, this is documented behavior. To work around it, prepend a blank line to the input stream: ( echo; cat ) | sed '1,/^fixed_pattern$/d' This does exactly what you want. I think it is possible to work around this in a single sed process, using the pattern space, but I the result would be very ugly! ---- Sam Kendall allegra \ Delft Consulting Corp. seismo!cmcl2 ! delftcc!sam +1 212 243-8700 ihnp4 / ARPA: delftcc!sam@nyu.ARPA