I have a log file with the name a.log! I want to sort it by fisrt field! If two lines have the same field, the order will be the original contens'! Content:
1. 101 c
2. 100 b
3. 100 a
4. 2 d
I expect the result:
1. 2 d
2. 100 b
3. 100 a
4. 101 c
So, I use this command!
sort -nt 't' -k 1 a.log
But the result:
1. 2 d
2. 100 a
3. 100 b
4. 101 c
Many thanks!
source
share