Problems sorting a CSV with sort

Tony Arnold tony.arnold at manchester.ac.uk
Thu Aug 8 22:32:11 UTC 2013


Johnny,

Just played with csvtool.

You could use it to replace the , field separators with TABs, say, pipe
through sort specifying TAB as the field delimiter and then pipe through
csvtool again to convert the fileds separators back to commas. E.g.:

csvtool -t ',' -u TAB cat input.csv | sort -f 2 -t '	' | csvtool -t TAB
-u ',' cat - > output.csv

Not tried the above so it may need adjusting, but I think you should get
the idea.

Regards,
Tony.

On 08/08/13 23:17, Tony Arnold wrote:
> This is the first field,"This is, well, the second field",The third
>> field could look like this

-- 
Tony Arnold,                        Tel: +44 (0) 161 275 6093
Head of IT Security,                Fax: +44 (0) 705 344 3082
University of Manchester,           Mob: +44 (0) 773 330 0039
Manchester M13 9PL.                 Email: tony.arnold at manchester.ac.uk




More information about the ubuntu-users mailing list