Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README

Convert the delimiter or quote character of a CSV file.

Requires python.

Examples:

Imagine we have a file, colors.csv, with the following data:

Id,Color,Color Name,Description,Hex #,Inventory,Add Date
1,red,Red,Having the color of blood,#f00,0.25,2014-10-16
2,green,Green,Having the color of growing grass,#0f0,10.18,2014-08-25
3,blue,Blue,Having the color of the clear sky,#00f,4.67,2014-09-17

To do "nothing" with the file at all:
~$ csv2csv --in-file colors.csv
Id,Color,"Color Name",Description,"Hex #",Inventory,"Add Date"
1,red,Red,"Having the color of blood",#f00,0.25,2014-10-16
2,green,Green,"Having the color of growing grass",#0f0,10.18,2014-08-25
3,blue,Blue,"Having the color of the clear sky",#00f,4.67,2014-09-17

Note that this quoted a number of fields, which shouldn't affect how the CSV is
interpreted.

Alternatively, one can do nothing with:
~$ cat colors.csv | csv2csv
Id,Color,"Color Name",Description,"Hex #",Inventory,"Add Date"
1,red,Red,"Having the color of blood",#f00,0.25,2014-10-16
2,green,Green,"Having the color of growing grass",#0f0,10.18,2014-08-25
3,blue,Blue,"Having the color of the clear sky",#00f,4.67,2014-09-17

To change the delimiter:
~$ cat colors.csv | csv2csv --out-delimiter '|'
Id|Color|"Color Name"|Description|"Hex #"|Inventory|"Add Date"
1|red|Red|"Having the color of blood"|#f00|0.25|2014-10-16
2|green|Green|"Having the color of growing grass"|#0f0|10.18|2014-08-25
3|blue|Blue|"Having the color of the clear sky"|#00f|4.67|2014-09-17

Or to a tab:
~$ cat colors.csv | csv2csv --out-delimiter '\t'
Id	Color	"Color Name"	Description	"Hex #"	Inventory	"Add Date"
1	red	Red	"Having the color of blood"	#f00	0.25	2014-10-16
2	green	Green	"Having the color of growing grass"	#0f0	10.18	2014-08-25
3	blue	Blue	"Having the color of the clear sky"	#00f	4.67	2014-09-17

Additional options exist to change the quote character (default ").

About

Change delimiters and quote characters in CSV files

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.