csvkitHow to rename a column with csvkit?
csvkit is a suite of command-line tools for working with CSV, the most popular being csvcut
and csvrename
.
To rename a column with csvkit, use the csvrename
command. For example, to rename the column "Name" to "Full Name" in the file example.csv
, use the following command:
csvrename -c Name,Full Name example.csv
This will output the following:
Full Name,Age
John,25
Jane,30
Code explanation
csvrename
: the command to rename a column-c
: the flag to specify the column to renameName,Full Name
: the original and new column namesexample.csv
: the file to be modified
Helpful links
More of Csvkit
- How to convert a tsv file to csv with csvkit?
- How to merge columns with csvkit?
- How to select specific columns with csvkit?
- How to remove duplicates with csvkit?
- How to skip the first line with csvkit?
- How to split a csv file with csvkit?
- How to install csvkit on a Mac?
- How to use csvkit on Windows?
- How to change the encoding in csvkit?
- How to reorder columns with csvkit?
See more codes...