Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re: a Sed question Message-ID: <5267@star.cs.vu.nl> Date: 2 Feb 90 02:43:17 GMT References: <520@mirsa.UUCP> Sender: news@cs.vu.nl Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatika, Amsterdam, the Netherlands Lines: 23 In article <520@mirsa.UUCP>, muller@mirsa.UUCP (Christophe Muller) writes: \... I wanted to find all the lines matching a \pattern, delete these lines _and_ the line immediately following. [...] ----------8<----------8<----------8<----------8<----------8<---------- #!/bin/sh case $# in 0) echo "Usage: `basename $0` pattern [files]" >&2 exit 1 esac q=\\ pattern=`echo x"$1" | sed -e 's/.//' -e "s-/-$q$q/-g"` shift sed "/$pattern/,/.*/d" $* ----------8<----------8<----------8<----------8<----------8<---------- -- What do the following have in common: access(2), SysV echo, O_NONDELAY? | Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart