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?
See man sort
:
-n, --numeric-sort
compare according to string numerical value
Thus, use
sort -n temp
The command sort by "dictionary-order" by default
If you want to order numerically use -n
sort -n file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.