csvkit: Cannot ADD a column to a CSV file
I was looking at all the tools in csvkit
, but couldn’t find any tool to add/insert an empty column to a CSV file. Surely something which should be part of csvkit
.
I’m happy to get involved, but wanted to check whether there is an easy way to do this and I have overlooked it. The closest I got was the the --linenumbers
option of csvcut
.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (7 by maintainers)
Commits related to this issue
- Add example for adding columns to a file, related #655 — committed to wireservice/csvkit by deleted user 8 years ago
- Add example to add a single column, #655 — committed to wireservice/csvkit by jpmckinney 5 years ago
- Add example to add a single column to the left, #655 — committed to wireservice/csvkit by jpmckinney 5 years ago
csvstack
can be used to add a column by utilizing the grouping variable feature:Another option is to just use awk. The following adds a column of 1337 to a csv (with headers).
As far as I can tell then
adds two columns called
a
andb
.adds a single named column.
Well, there are lots of ways to do this, but I guess such a basic operation as adding a column should be able to be done with csvkit itself…