Skip to content

Commit b6e7740

Browse files
committed
n(numerically) r(reverse) -k3,3 → sort by column 3 only, not the whole line, and head -3 → show the first 3 lines of the sorted output
1 parent e487d49 commit b6e7740

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

shell-pipelines/sort-uniq-head-tail/script-03.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ set -euo pipefail
88
# Basia London 22 9 6
99
# Piotr Glasgow 15 2 25 11 8
1010
# Chandra Birmingham 12 6
11-
sort
11+
12+
sort -k3,3nr scores-table.txt | head -3
13+
# sort by column 3 numerically (highest first) and show top 3 lines.
14+
# n(numerically) r(reverse) -k3,3 → sort by column 3 only, not the whole line, and head -3 → show the first 3 lines of the sorted output

0 commit comments

Comments
 (0)