csvkitHow to fetch unique values with csvkit?
csvkit is a suite of command-line tools for working with CSV, the most popular being csvcut
and csvgrep
.
csvcut
can be used to fetch unique values from a CSV file. For example, to fetch the unique values from the "Name" column of a CSV file named "example.csv":
csvcut -c Name example.csv | sort | uniq
The output of this command will be a list of unique values from the "Name" column:
Alice
Bob
John
The command consists of three parts:
-
csvcut -c Name example.csv
: This part of the command usescsvcut
to select the "Name" column from the "example.csv" file. -
sort
: This part of the command sorts the output of thecsvcut
command. -
uniq
: This part of the command filters out any duplicate values from the sorted output.
For more information about csvkit, see the csvkit documentation.
More of Csvkit
- How to convert a tsv file to csv with csvkit?
- How to select specific columns with csvkit?
- How to split a csv file with csvkit?
- How to remove duplicates with csvkit?
- How to rename a column with csvkit?
- How to merge columns with csvkit?
- How to change the encoding in csvkit?
- How to skip the first line with csvkit?
- How to reorder columns with csvkit?
See more codes...