Lightning Bolt
Lightning Bolt

Reputation: 51

grep|sort and display only the first line

I am trying to grep for a pattern and sort by a column and display only the first line by using the following command:

grep "BEST SCORE" Result.txt | sort -nk 4 | "display only first line"

I don't want to save the grep neither thesort result into a file.

Upvotes: 5

Views: 11985

Answers (1)

Ted Hopp
Ted Hopp

Reputation: 234807

grep "BEST SCORE" Result.txt|sort -nk 4|head -1

Upvotes: 11

Related Questions