Apr 13, 2005 #1 amarg Programmer Joined Nov 19, 2002 Messages 106 Location IN Hi, I have some data in CSV Fromat. I want to sort the file based on first field on the command prompt. Thanks, Amar
Hi, I have some data in CSV Fromat. I want to sort the file based on first field on the command prompt. Thanks, Amar
Apr 13, 2005 #2 chipperMDW Programmer Joined Mar 24, 2002 Messages 1,268 Location US Code: sort file Upvote 0 Downvote
Apr 14, 2005 #3 SamBones Programmer Joined Aug 8, 2002 Messages 3,186 Location US Actually, if the first field varies in length, that might not work. It should be... Code: sort -t ',' -k 1 file.csv > file.sorted.csv The "[tt]-t[/tt]" defines the field separator, and the "[tt]-k[/tt]" defines which field to sort on. Hope this helps. Upvote 0 Downvote
Actually, if the first field varies in length, that might not work. It should be... Code: sort -t ',' -k 1 file.csv > file.sorted.csv The "[tt]-t[/tt]" defines the field separator, and the "[tt]-k[/tt]" defines which field to sort on. Hope this helps.
Apr 15, 2005 Thread starter #4 amarg Programmer Joined Nov 19, 2002 Messages 106 Location IN That's what I am looking for. Thanks. Upvote 0 Downvote