grep replacement
XMRP50000[jcm]-a.v.reed
avr at mtgzz.UUCP
Wed Jun 1 02:26:55 AEST 1988
In article <2450011 at hpsal2.HP.COM>, morrell at hpsal2.HP.COM (Michael Morrell) writes:
> Also, what line number it was found on.
> grep -n does this, but I'd like to see an option which ONLY prints the line
> numbers where the pattern was found.
# In ksh's $ENV - otherwwise use a shell script:
function lngrep {
if [ "$#" = '1' ]
then grep -n $@ | cut -f1 -d:
else grep -n $@ | cut -f1,2 -d:
fi
}
Adam Reed (mtgzz!avr)
More information about the Comp.unix.questions
mailing list