a Sed question

Maarten Litmaath maart at cs.vu.nl
Fri Feb 2 13:43:17 AEST 1990


In article <520 at mirsa.UUCP>,
	muller at 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 at cs.vu.nl,  uunet!mcsun!botter!maart



More information about the Comp.unix.questions mailing list