Reputation: 219
I have a big file with 2 columns. Words and Numbers. i want to sort by the second column numerically.
I run this command:
sort -k2 words.txt
and I get this result:
Release 99
Some 99
tmc 99
watcher 99
no 990
in 9909
one 992
I want this to be sorted numberically. Why does it have "in 9909" as second last?
tia!
Upvotes: 2
Views: 2378
Reputation: 272752
You also need the -n
flag to perform a numeric sort rather than a lexicographic sort.
Upvotes: 6