Aidan Gomez
Aidan Gomez

Reputation: 8627

Unix Command Finding Max Line Value

I have a text file with a series of floating point numbers – one per line – like so:

1
0.98
1.21
0.68
0.647
0.1

More specifically: I generate these lines using an awk call.

How would I go about extracting the largest of these numbers in a single call? Bonus points for extracting the top n values.

Upvotes: 0

Views: 145

Answers (1)

grimsock
grimsock

Reputation: 794

Try this cat your_filename | sort -n | head -1

Read about head - you can pass number of how many lines you want to display.

Does it solve your problem?

Upvotes: 1

Related Questions