[ale] grep
Chris Hamilton
chrish at ifsintl.com
Thu Nov 13 19:07:23 EST 1997
> Is there any non-shell script way to make grep return just the line
> numbers of matches and not the content of the line?
>
> For example,
>
> grep -n will return something like this:
>
> 11: exec ls
> 36: exec foo
>
> All I want are the line numbers and I do not want to have to use any sort
> of shell script to chop of the ends.
>
> If this is not possible, how would it be done with a shell script?
>
grep -n <expr> [<files...>] | find -d ':' -f 1
-d = delimiter
-f = field (seperated by delimiter)
---
Christopher Hamilton Internal System Administrator
chrish at ifsintl.com IFS International, Inc.
More information about the Ale
mailing list