does a zgrep exist? (zgrep <> zcat | grep)

Mike Faber sleepy at wybbs.mi.org
Wed Feb 20 02:13:14 AEST 1991


a simple shell invoked with arguements is easy enough...

$ sh zgrep string file [file ...]

zgrep:
if [ $# -lt 2]
then
	echo usage:
	exit 1
fi

vgrep=$1
shift

while [ $# -gt 0 ]
do
	zcat $i | grep $vgrep | awk fil=$1 '{printf("%s:%s\n",fil,$0)}'
	shift
done


Now, was that so painful...

--
sleepy at wybbs.UUCP
Michael Faber



More information about the Comp.unix.shell mailing list