Re: read min line number from a file

From: mgrd (mgrd_at_gmx.net)
Date: 12/20/03


Date: Sat, 20 Dec 2003 22:09:09 +0100

jfuture_99@yahoo.com wrote:
[..]
> For example, I want get line number that matchs "new customer" patter
> from a file "record.a". I do this:
>
> grep -n -i "new customer" record.a | cut -d: -f1
>
> It will give a lot of line numbers, 12, 111, 123, .... All I want is
> the smallest number that is 12. How can I do that?

grep -n -i "new" customer record.a | cut -d: -f1 | sort -n | head -1