Search This Blog

Thursday, November 15, 2018

delete column of csv

File: tmp.csv

Content:
a,b,c
1,2,3
10,20,30

Task: Remove 1st column.

Expected Output:
b,c
2,3
20,30

Command:
cut -d, -f1 --complement tmp.csv > new_tmp.csv

Options:
-d : delimeter
-f : fields to select
--complement: complement the set of selected bytes, characters or fields

Summary:
Above command is selecting the 1st column with a delimiter , and complementing the result set and saving output to new_tmp.csv.