Sort CSV file by column priority using the “sort” command

前端 未结 4 392
自闭症患者
自闭症患者 2020-12-07 12:21

I have a csv file, and I would like to sort it by column priority, like \"order by\". For example:

3;1;2
1;3;2
1;2;3
2;3;1
2;1;3
3;2;1

If t

4条回答
  •  情歌与酒
    2020-12-07 12:28

    Charlie's answer above didn't work for me on Cygwin (sort version 2.0, GNU textutils), the following did:

    sort -t"," -k2 -k1 -k1
    

提交回复
热议问题