qvd2csv
(since EVL 2.4)
Read <file.qvd>
and write CSV file to <file.csv>
or standard output. It uses data
types from QVD header or from existing <evd>
file or from <inline_evd>
.
EVD is EVL data definition file, for details see man 5 evd.
Synopsis
qvd2csv <file.qvd> [-o|--output=<file.csv>] [--all-as-string | --real-as-decimal[=<precision>,<scale>]] [-d|--date=<format>] [-h|--header=<field_name>,...] [-n|--no-header] [-l|--null=<string>] [-q|--quote=<char>] [-s|--separator=<char>] [-t|--datetime=<format>] [-a|--dos-eol | -b|--mac-eol] [--filter=<condition>] [--first-record=<n>] [--guess-uniform-symbol-size] [--low-memory] [-v|--verbose] qvd2csv <file.qvd> (<evd>|-d <inline_evd>) [-m|--match-fields] [-o|--output=<file.csv>] [-h|--header=<field_name>,...] [-n|--no-header] [-a|--dos-eol | -b|--mac-eol] [--filter=<condition>] [--first-record=<n>] [--guess-uniform-symbol-size] [--low-memory] [-v|--verbose] qvd2csv ( --help | --usage | --version )
Options
- --all-as-string
-
interpret all fields as strings. (Since EVL 2.5.)
- -d, --data-definition=<inline_evd>
-
either this option or the file
<evd>
must be presented to use already defined (custom) EVD - -a, --dos-eol
-
output DOS end-of-line, i.e. CR+LF (‘\r\n’)
- -b, --mac-eol
-
output Mac end-of-line, i.e. CR (‘\r’)
- --date=<format>
-
to specify a
<format>
for date data type - --filter=<condition>
-
read only records with given
<condition>
. (Since EVL 2.6.) - --first-record=<n>
-
start to read from the record number
<n>
. (Since EVL 2.6.) - --guess-uniform-symbol-size
-
might speed up indexing of dictionary, but it could not work in all cases. Use only in special cases when need really good performance. (Since EVL 2.6.)
- -h, --header=<field_name>,...
-
use comma separated list of field names instead of header line, for example when you don’t want to use field names from QVD header.
- --low-memory
-
do not read dictionary into memory. This could save memory consumption, but slows down reading the source file. (Since EVL 2.6.)
- -l, --null=<string>
-
to specify what string is used for NULL values in CSV, empty string is allowed
- -m, --match-fields
-
to read only a subset of fields from QVD file or to read them in different order
- -n, --no-header
-
with this option it produces no header line
- -o, --output=<file.csv>
-
write output into
<file.csv>
instead of standard output - -q, --quote=<char>
-
to use quoted fields for the CSV output. When data contains such
<char>
, all of them are escaped by duplicating them. For example using ‘--quote="\""’ will serve data like ‘some "text"’ as ‘"some ""text"""’. - --real-as-decimal[=<precision>,<scale>]
-
interpret ‘real’ data types as ‘decimal(<precision>,<scale>)’. When no
<precision>
or<scale>
is specified, use values from environment variables ‘EVL_DEFAULT_DECIMAL_PRECISION’ and ‘EVL_DEFAULT_DECIMAL_SCALE’, which are by default set to 18 and 2. (Since EVL 2.5.) - -s, --separator=<char>
-
to use
<char>
as field separator for the CSV output - -t, --datetime=<format>
-
to specify a
<format>
for datetime data type - -v, --verbose
-
print to standard error output info/debug messages
- --help
-
print this help and exit
- --usage
-
print short usage information and exit
- --version
-
print version and exit
Examples
- Having ‘some.qvd’, the command to produce CSV file with empty strings representing NULL
values, dates in format ‘DD.MM.YYYY’ and with Windows end-of-line (i.e. CRLF):
qvd2csv --null="" --date="%d.%m.%Y" --dos-eol some.qvd > some.csv
- To filter only particular records from ‘large.qvd’, for example we would like to read only
latest records represented by field ‘invoice_id’:
qvd2csv --filter="invoice_id>7654000" large.qvd > latest.csv
- To cut only particular columns from ‘large.qvd’, for example only column ‘invoice_id’:
qvd2csv --match-fields -d 'invoice_id int null=""' large.qvd > latest.csv
- To read only after by some number of rows:
qvd2csv --first-record=1234000 huge.qvd > latest.csv
This could be quite useful when reading a huge QVD file.