Reputation: 23
I am new to unix and I want to create a script to sort the lines inside a csv file based on the timestamp given as a field and then choose the latest line of the csv file and redirect it to a new csv file...
sample csv file:
abc,def,ghi,2014/10/10_15:44:32:55
as,dsj.sdk.2014/10/15_13:21:44:32
asas,asas,dfdf,2013/11/16_21:14:18:16
Please do provide an in detail explanation to the written commands in the script
Thanks in advance..
Upvotes: 0
Views: 837
Reputation: 37053
Try something like:
sort --field-separator=',' --key=4 -n test.txt
Which means you are separating each line by comma (","), sorting on field 4 and sorting it by numbers.
Upvotes: 1