Issue
I want to sort file, by the first number, which looks like this.
11: wc
1:cmp:
115:wc
7:ls
So i get output in file like this.
1:cmp:
7:ls
11: wc
115:wc
I've tried to sort it my self, but it doesn't work. This is my following code
cat dat | sort -t ":" -k 1 >dat;
What can i do? Thank you!
Solution
You can use this sort
command with numeric sort:
sort -t: -nk1 file
1:cmp:
7:ls
11: wc
115:wc
Answered By - anubhava Answer Checked By - Cary Denson (WPSolving Admin)