Skip to content

common options

Chris Lowth edited this page Sep 21, 2022 · 11 revisions

Common options

Many of TBUtil's sub commands support a sub-set of common formatting options. These are..

Option Meaning
-j Output as a JSON text document with indentation to make reading easy.
-J Output as a JSON text document without indentation.
-l Output in long text format as opposed to just listing the element UUIDs. The output is formatted as a simple table.
-L Output in long text format, printing one field per line
-s Format the output using a [[custom formatter script
-x Output to a named spread-sheet file. The format of the file depends on its extension.
Supported types are: .xlsx, .csv, .lst, .html, .sql or .txt.
Example: -x clusters.xlsx
-y Output as a YAML text document
-columns The output is limited to just the specified columns. These are specified as a single string of comma-delimited numbers. Column 0 is the first column.
Example: -columns "0,2,3,5"

The -x file types are indicated by the file extension. Supported extensions are..

Extension Output file format
.csv A standard CSV file with...
- A header line.
- Comma-delimited fields.
- One record per row.
- Fields will be quoted if required to handle fields that contain commas or new lines.
.lst A simple listing with...
- One record per row.
- No header line.
- Fields are delimited by the pipe symbol.
- No quoting is used so fields that contain pipes or newlines are challenging to parse.
.sql A text file containing the SQL commands needed to create a populate the data into a SqLite3 database table.
.txt A text file containing the same format as the -l option produces.
.html A text file containing an HTML table.
.xlsx An Excel spread sheet.

Notes:

  • if "-x" is used to write to a .csv file, the Linux end-of-line sequence (LF) is used rather than the CRLF sequence specified in RFC4180. If you want a file that uses CRLF end-of-lines, then use a tool such as "unix2dos" to convert the created file (NB: this is even true on Windows).
  • The special names "@.csv", "@.lst", "@.txt" and "@.html" can be used to write the desired format to the standard output ("@.xlsx" is NOT supported).

The "import" commands typically take one or more of ..

Option Meaning
-create the imported item will be created (it must NOT already exist).
-edit the imported item will be updated (it MUST already exist).

If neither -create nor -edit are specified then the user will be created if it doesnt exist, or editted if it does - as appropriate.

Clone this wiki locally