I have this file I would like to sort with the order "sort" in linux (very beginner)
I tried sort without parameter, without success. I tried sort -n, without success.
Is it because there are a lot of "blanks" on each line to be sorted ?
How to sort this kind of file ?
EDIT :
I would like the result in the same file. that's perhaps why it does not work ?
example :
3703900012346016020810100200 0992
3703900012346016022210100600 0992
3703900012346016022310100600 0992
3703900012346016022410100600 0992
3703900012346016020210170100 0992
3703900012346016020312600700 0992
3703900012346016020512910200 0992
3703900012346016021013600200 0992
3703900012346016020113690100 0992
3703900012346016021213700900 0992
3703900012346016020813800200 0992
3703900012346016021314100500 0992
3703900012346016020614200200 0992
3703900012346016020714290200 0992
3703900012346016021414400300 0992
3703900012346016021514700400 0992
3703900012346016021614780600 0992
3703900012346016021714790800 0992
3703900012346016021895200800 0992
use sort -n -k 1.10,1.23 filename
.
-n is a numeric sort. -k describes where the key is. Look at sorts man page. In my example I describe a key from columns 10-23. You may not need -n since it looks like all the characters are between 0-9.
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.