CSVfox
Get the job done.

-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 (see ±quotechar), they are just separated by the delimiter character (see ±delimiter). But as soon as the data field contains text with line breaks, or the delimiter character itself, it has to be enclosed to make this clear.

Some not completely compliant programs however work better if all data fields are enclosed. Others might misinterpret the text quote character as part of the field content, so it must be generally omitted.

Please be aware that if text quoting shall be inhibited, precautions must be made in case a field might contain a line break or a quote char itself. These should be removed or replaced by a different pattern before this command takes place, because otherwise, the CSV file might become badly formatted and unreadable.

Enforcing Quoting for all Data Fields

This command enforces enclosing each and every data field with the quotation character (which is mostly a double quote ").

Pattern

-f -forcequote

 

Setting the Quoting Rules for all Data fields

This command can force enclosing each and every data field with the quotation character (which is mostly a double quote "), or it will inhibit any text quoting, if required.
As a parameter for its setting "y", "yes", "true", or "1" will be accepted, as well as "n", "no", "false", or "0". Upper/Lower case will be ignored.

An additional value is "auto", which means enclosing according to the standard CSV rules. This is also the standard setting.

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 a pair of quotation 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=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

Setting Rules for Selected Columns

It is also possible to enforce (or to inhibit) quoting for certain columns where the automatism does not see the requirement. This might be the case when preparing for import to some software which needs this.
The colunms not mentioned are still quoted according to the automatism, because otherwise the CSV rules would be hit. 

Pattern

-f[column],[column]-[column],... -forcequote[column],[column]-[column],... -f  [column],[column]-[column],...=truthvalue -forcequote [column],[column]-[column],...=truthvalue

If it is necessary to strictly not quote the columns that are omitted in the command above, you will need two commands:
1. disabling the quoting of all column contents generally
-forcequote=N 
2. forcing quoting for all denoted columns
-forcequote[column],[column]-[column],...=Y  


Hints

This command is only relevant for writing CSV output files.
It will be ignored when reading input or merge CSV files.
Under construction, coming soon