2

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!

0

1 Answer 1

6

You also need the -n flag to perform a numeric sort rather than a lexicographic sort.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.