V
V
Vladislav2014-09-17 17:45:22
linux
Vladislav, 2014-09-17 17:45:22

Outputting sorted file data in Unix terminal?

Good evening, there is a file with the content of the form:

10/10
12/10
9/10
3/10
16/10
11/10
2/10
2/10

tell me how you can display three lines whose first digit (numerator) is the largest.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2014-09-17
@McClay

cat filename |sort -nr|head -n3or
cat filename |sort -n|tail -n3

R
Really_Amber, 2014-10-06
@Really_Amber

sort -nr < filename.txt | sed -n '1,+2p'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question