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 split a csv file with csvkit?
- How to convert JSON to CSV using csvkit?
- How to remove duplicates with csvkit?
- How to extract a column from a CSV file using csvkit?
- How to skip the first line with csvkit?
- How to use csvkit on Windows?
- How to diff two CSV files using csvkit?
- How to change the delimiter in csvkit?
- How to fetch unique values with csvkit?
See more codes...