Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!kodak!uupsi!sunic!ugle.unit.no!nuug!ifi!kjetilho From: kjetilho@ifi.uio.no (Kjetil Torgrim Homme) Newsgroups: comp.unix.shell Subject: Re: does a zgrep exist? (zgrep <> zcat | grep) Message-ID: Date: 18 Feb 91 18:45:22 GMT References: <1991Feb15.232854.13378@robobar.co.uk> <463@bria> <1991Feb18.075330.15536@convex.com> Sender: kjetilho@ifi.uio.no (Kjetil Torgrim Homme) Organization: University of Oslo, Norway Lines: 21 In-Reply-To: tchrist@convex.COM's message of 18 Feb 91 07:53:30 GMT A suggestion for a zgrep-script: It has the slight problem that options has to be specified in quotes, like zgrep ^foo "-n -v" *.Z zgrep 'bar[f-o]' "" *.c.* Note: no options has to be denoted by empty quotes. An oddity: The name of the file comes after grep's output. Just my 2 xre. (Does the eighth bit survive the Atlantic Ocean?) Kjetil T. #! /bin/sh regexp=$1; options=$2; shift 2 for file in $@; do zcat $file | grep -e $regexp $options if test $? = 0; then echo "-- $file --" fi done