Data Operation - Print
About
print is an intermediate operation that prints the content of data resources in the terminal console (ie to standard out, ie stdio.out).
Arguments
| Name | Default | Description |
|---|---|---|
| format | default | pipe, stream, default |
| print-table-header | true | Print the table header (resource name and comment) |
| print-columns-headers | true | Print the columns headers |
| print-non-visible-characters | true | Print the non-visible characters such as end of line |
| footer-separation-line-count | 1 | The number of empty line printed in the footer |
| colors-column-name | The name of a column that stores a color_definition | |
| boolean-true-token | ✓ | The string representation of the Boolean value true |
| boolean-false-token | The string representation of the Boolean value false | |
| null-token | <null> | The string representation of the Null value |
| string-empty-token | <empty> | The string representation of an empty string |
| string-blank-token | <blank> | The string representation of an blank string (ie only whitespace) |
Note: the default values <null>, <empty> and <blank> are the empty string if this is not a diff report (ie if the colors column is not found)
Format
Pipe
pipe is a format suitable when tabul is used in a pipeline shell (ie suitable for the pipe operator of a shell).
It will not print:
- any headers (table or column) or footer
- any non-visible characters
Note that the concat command with only one source as argument is an alias to the pipe mode.
Example:
tabul data cat --strict-selection characters.csv@howto
last_name,first_name,birth_date,wikipedia_page
Schwarzenegger,Arnold,1947-07-30,https://en.wikipedia.org/wiki/Arnold_Schwarzenegger
Norman,Don,1935-12-25,https://en.wikipedia.org/wiki/Don_Norman
Harbison Carnagey,Dale,1888-11-24,https://en.wikipedia.org/wiki/Dale_Carnegie
Kahneman,Daniel,1934-03-05,https://en.wikipedia.org/wiki/Daniel_Kahneman
Pittman,Bob,1953-12-28,https://en.wikipedia.org/wiki/Robert_Pittman_(media_executive)
Stream
stream is a format suitable to print immediately records received from an upstream operation that send them in a stream mode.
It will:
- print the header once
- not print any footer
This is the default format if print runs in a stream pipeline.
Default
default prints the table in the default tabulify format
Color Definition
To color cells in a terminal, you can:
- add a column with the colors-column-name argument
- that will store a column definition.
A color definition is a series of cell color definition separated by a comma.
Example:
# cell 1 in green, cell 4 in green, cell 5 in blue
1g,4g,5b
# cell 1 in red, cell 4 in red, cell 5 in blue
1r,4r,5b
# all cells in red
r
# all cells in blue
b
The cell color definition syntax is:
[n]c
where:
- n is an optional column position (ie the column to color). If omitted, the whole record gets the color
- c is the color
- r for red
- g for green
- b for blue
Cli
The print operation is used in the following tabul command: