-forcequote, -f
Defining whether CSV data fields will have to be enclosed in quotation characters
Description
Generally, in CSV files simple data fields containing just a word or a number do not need to be enclosed in quote characters
Some programs however work better if all data fields are enclosed. Others will misinterpret the text quote character as part of the field content, so it must be generally omitted.
This command can force enclosing each and every data field with the quotation character (which is mostly a double quote
The standard value is "auto".
Pattern
-f=truthvalue
-forcequote=truthvalue
Usage Examples
This is an example of some standard raw CSV file lines with automatic enclosing.Each CSV field that contains whitespace has been enclosed using the quotation character
City,Name,Birth,"Driver License"
Rome,"Andrea Bocelli",1958,y
"Los Angeles","Lieutnant Columbo",1927,y
London,"Hercule Poirot",1910,-
"New York","Theodoros Kojak",1922,y
- csvfox infile.csv -f=Y outfile.csv
- This enforces that the output CSV file has each field enclosed with the quotation character, regardless of whether it contains line breaks, whitespaces, or delimiter characters.
"City","Name","Birth","Driver License" "Rome","Andrea Bocelli","1958","y" "Los Angeles","Lieutnant Columbo","1927","y" "London","Hercule Poirot","1910","-" "New York","Theodoros Kojak","1922","y"
- csvfox infile.csv -f=N outfile.csv
- This enforces that the output CSV file will not enclose any field with the quotation character, regardless of whether it contains line breaks, whitespaces, or delimiter characters.
City,Name,Birth,Driver License Rome,Andrea Bocelli,1958,y Los Angeles,Lieutnant Columbo,1927,y London,Hercule Poirot,1910,- New York,Theodoros Kojak,1922,y
Hints
This command is only relevant for writing CSV output files.It will be ignored when reading input or merge CSV files.