awk's seen idiom
Distinctifying a CSV column using awk alone.
I wanted to extract distinct values of a particular column in a csv file, and just found awk
has a concise idiom to do just that. Say you want to operate on the 2nd column, hence $2
in the following snippet. This is all it takes:
awk -F',' '!seen[$2]++' a.csv
seen
is merely an example. You may use (at least) anything from the [A-Za-z_]+
domain.