0

I have one file named temp following are the data in the file

0.9
1
2
3
10
4
5
6

When i am execute sort temp in the terminal i am getting the answer as

0.9
1
10
2
3
4
5

But my expected answer is

0.9
1
2
3
4
5
10

Can anyone help me in this?

2 Answers 2

2

See man sort:

  -n, --numeric-sort
          compare according to string numerical value

Thus, use

sort -n temp
Sign up to request clarification or add additional context in comments.

Comments

1

The command sort by "dictionary-order" by default

If you want to order numerically use -n

sort -n file

1 Comment

I understood and Thanks.

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.