Sort command in not working properly in unix for sorting a csv file

后端 未结 3 2042
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-27 02:07

I have a csv file which I need to order based on the timestamp. It is the third column in the csv and I am using below commands to sort:

awk \'NR<2{print $_;n         


        
3条回答
  •  青春惊慌失措
    2021-01-27 02:31

    I will try to sort by date and then by time

    awk -F"," '{print $3,$1,$2}' file.csv | sort -d' ' -k 1d -k 2d
    

    BTW, it would be great if you just share a small section of your file. :)

提交回复
热议问题