!sort -k 1n hits.csv -o output.csv
The above sorts the file according to the field preceding the first comma. But how do I keep the first line? (I want the first line of hits.csv to appear as first line in output.csv as well.)
!sort -k 1n hits.csv -o output.csv
The above sorts the file according to the field preceding the first comma. But how do I keep the first line? (I want the first line of hits.csv to appear as first line in output.csv as well.)
$ pg test1.txt
keep this line
55, some stuff 1, other stuff 1
6, some stuff 2, other stuff 2
111, some stuff 3, other stuff 3
2, some stuff 4, other stuff 4
4, some stuff 5, other stuff 5
6, sdsdsdsdsdsdsds
7, ttttttttt
$ head -n 1 test1.txt >sorted.txt && tail -n +2 test1.txt | sort -k 1n >> sorted.txt
$ pg sorted.txt
keep this line
2, some stuff 4, other stuff 4
4, some stuff 5, other stuff 5
6, sdsdsdsdsdsdsds
6, some stuff 2, other stuff 2
7, ttttttttt
55, some stuff 1, other stuff 1
111, some stuff 3, other stuff 3