coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sorting csv with embedded commas problem


From: Boyd Kelly
Subject: Sorting csv with embedded commas problem
Date: Wed, 30 Jun 2021 19:52:36 +0000

Hello,

Not sure if I am doing this correctly, but I seem to have a problem sorting
when the first column of my data contains a uuid often with embedded
commas.  Does sort deal with this properly?

My file contains this: (where the first and last fields may contain
embedded commas.

"}~,)4",nɛgɛso,yq,,vélo,,,,,0630
"wjv(,4q_S}",badenmuso,cj,,soeur,,,,,"0630, fam, gens"
ARm}q0bjb#,a be baara kɛ.,bk,,il travaille.,,,,,"0630, phrase"

The following is not correctly sorted by the second field
$  sort -t "," -k 2 test2.csv
"}~,)4",nɛgɛso,yq,,vélo,,,,,0630
"wjv(,4q_S}",badenmuso,cj,,soeur,,,,,"0630, fam, gens"
ARm}q0bjb#,a be baara kɛ.,bk,,il travaille.,,,,,"0630, phrase"

However the second column alone will sort fine:
$  sort test2.txt
a be baara kɛ
badenmuso
nɛgɛso
Thanks for any enlightenment!

-- 
Boyd Kelly <bkelly@coastsystems.net>
www: http://www.coastsystems.net
Tel: +1 604 837-0765


reply via email to

[Prev in Thread] Current Thread [Next in Thread]