grep replacement

Geoff Rimmer maujd at warwick.UUCP
Fri Jun 10 04:46:10 AEST 1988


In article <2450011 at hpsal2.HP.COM> morrell at hpsal2.HP.COM (Michael Morrell) writes:
>grep -n does this, but I'd like to see an option which ONLY prints the line
>numbers where the pattern was found.

How about

	grep -n pattern file | sed "s/:.*//"

?
	------------------------------------------------------------
	Geoff Rimmer, Computer Science, Warwick University, UK.
	maujd at uk.ac.warwick.opal
	------------------------------------------------------------



More information about the Comp.unix.questions mailing list