A paramfile command denotes a file which in turn contains some CSVfox command line parameters.
A parameter file is a plain text file. Each line contains exactly one CSVfox parameter. So the commands will be read from the parameter file line by line.
They will be processed in order, as if they were placed in the command line at the position the %paramfile command was called.
This allows better clarity of commands, reuse in different constellations, and it saves the quoting of spaces embedded in the parameter.
Especially for a very long sequence of command line parameters, or a complex
In every shell there are also various control characters and wildcard mechanism, as well as forwarding and redirection signs, that may interfere with CSVfox commands; these effects can also completely avoided by using a parameter file.
%paramfile=filename %paramfile/encoding=filenameThe %paramfile command can be specified alone or between other csvfox commands.
Multiple %paramfile commands are possible on the same command line. %paramfile files can even be nested.
The character set used in the parameter file can be optionally specified using the "/" option.
In the parameter file, each line contains one argument that otherwise would have been a program parameter. Every blank space is part of the expression, so included and trailing whitespaces must be carefully avoided, if they are not intended part of the command expression.
Preceding whitespaces are ignored and can be used for better visual structuring of the file.
On the other hand, any enclosing of commands, expressions, field names containing blank spaces, is not necessary, because they are not splitted automatically at whitespace.
A parameter file can have any supported encoding, so it overcomes any restricting or command line character sets. This is especially important for Windows, as in Linux or MacOS an UTF-8 shell is standard which implies only few character restrictions.
Imagine the command line sequence:
- csvfox infile.csv +delim=, -delim=; -set[a]=([*]+20%) "
my output file.csv"
And from now on, you can simply call:
- csvfox %paramfile=myparameters.txt
You can place all or only some of the required parameters into a parameters file. This way it is possible to prepare some building blocks that can be used frequently.
- csvfox infile.csv %paramfile=us_to_ger.txt outfile.csv
- The parameter file us_to_ger.txt contains a set of conversions that can be made to better fit a CSV file that follows US customs to the German locale (on a legacy Windows PC). It changes the CSV delimiter from comma to semicolon, the encoding from ASCII to Windows-1252, and replaces the decimal dot in the field "Price" with a decimal comma.us_to_ger.txt+delim=, +encoding=ASCII -delim=; -encoding=Windows-1252 -regex[Price]=\d\.\d/\1,\2
The file is here being used for modifying infile.csv to outfile.csv.
- csvfox infile.csv %paramfile/UTF-8=us_to_ger.txt outfile.csv
- Reads the parameters from us_to_ger.txt explicitly in UTF-8 format instead of the platform-specific default format, and uses them for modifying infile.csv to outfile.csv.
- csvfox infile.csv %paramfile=us_to_ger.txt -rename[Price]=[Amount] -columns=- outfile.csv
- Reads the parameters from us_to_ger.txt again, and uses them for modification from infile.csv to outfile.csv.
And there additional commands to execute, as the field "Price" will have to be renamed to "Amount" in outfile.csv, and the output file shall only contain the fields from number 3 to 6.