ptbl


NAME

ptbl - quick and easy printing of an rdbtable


SYNOPSIS

ptbl [options]


OPTIONS

Options may be abbreviated.

-b0
By default, when a multi-line record of output for each row is necessary (due to the width of the current window or terminal) the program will try to fill space at the end of lines that would otherwise be wasted by moving some columns. This option prevents the moving of any columns.

-b[N]

This option attempts a ``best fit'' by rearranging columns (widest columns first). If 'N' is given the first N columns of the first line will not be moved. The default condition is -b .

-Bigf
Handle very large data fields, e.g. over 1000 characters. This option takes longer but it works for any size data fields.

-edit
Edit form of output, used primarily by 'etbl'.

-fold
Fold long data fields into multi line data based on the defined field width. May be used with the -t option to limit the field width. Only a single line record of output is produced with this option.

-help
Print this help information.

-iN
Indent size of N spaces on 2nd and later lines of a multi-line record of output. Default is 4 spaces.

-lN
Line length of N characters for output. Default is the width of the current window or terminal.

-pN

Page size in of N lines. Default is the height of the current window or terminal. A value of zero (-p0) will turn paging off.

-PX[stg]
Page headings and settings for printing. A two line heading is put onto each page: page number, current date, and an optional string (stg). Sets page length (in lines) and line length (in characters) according to the value of 'X' as follows.

P
page: 60 line: 80 (default font size)

R
page: 47 line: 116 (rotated default)

A
page: 51 line: 125 (rotated 10 point font)

8
page: 63 line: 144 (rotated 8 point font)

6
page: 82 line: 192 (rotated 6 point font)

W
page: and line: from current window size.

Other desired page and/or line size options may be set after.this in the option list.

-sK
Separator 'K' (which may be multi character) placed between columns. Default is two spaces.

-t[N]
Truncate data to the width defined in the header. If N is given the width of printed fields will be further limited to N characters.

-window
List as many columns as possible in single line records that will fit in the current window or terminal width.

.


DESCRIPTION

This operator is used for quick and easy printing of an rdbtable, in a simple but useful form. It prints an rdbtable using formatting information from the header.

The printing of each row of data will be on one line if possible, but when multiple lines are necessary the second and later lines are indented for readability. Also when multiple lines are necessary a simple space availability algorithm is used to minimize the number of lines printed for each row of data. This may result in the order of some data values being rearranged from their order in the rdbtable. The -b0 option can override this algorithm and force the same printing order as in the rdbtable.

This RDB operator reads an rdbtable from STDIN and writes a formatted report on STDOUT. Options may be abbreviated.

As an example using the rdbtable shown in Table 1 (named sample), the command to view this rdbtable would be:

ptbl < sample

Table 1

RDBTABLE (SAMPLE)

# Table documentation lines. These describe and # identify the rdbtable contents. # They may be read by many normal UNIX utilities, # which is useful to easily identify a file. # May also contain RCS or SCCS control information. NAME COUNT TYP AMT OTHER RIGHT 6 5N 3 5N 8 8> Bush 44 A 133 Another This Hansen 44 A 23 One Is Jones 77 X 77 Here On Perry 77 B 244 And The Hart 77 D 1111 So Right Holmes 65 D 1111 On Edge

which would produce the output shown in Table 2. The same command with a page heading for printing:

ptbl -PP < sample

produces the output as shown in Table 3. Using an rdbtable (named sample4) that has long data values, shown in Table 4, the command to print the rdbtable using the truncate option is:

ptbl -t < sample4

Table 2

PRINTING RDBTABLE (SAMPLE) USING PTBL

NAME COUNT TYP AMT OTHER RIGHT ------ ----- ---- ----- -------- -------- Bush 44 A 133 Another This Hansen 44 A 23 One Is Jones 77 X 77 Here On Perry 77 B 244 And The Hart 77 D 1111 So Right Holmes 65 D 1111 On Edge

Table 3

PRINTING RDBTABLE (SAMPLE) WITH PAGE HEADING USING PTBL

Page 1 Mon Dec 2 16:56:43 PST 1991 NAME COUNT TYP AMT OTHER RIGHT ------ ----- ---- ----- -------- -------- Bush 44 A 133 Another This Hansen 44 A 23 One Is Jones 77 X 77 Here On Perry 77 B 244 And The Hart 77 D 1111 So Right Holmes 65 D 1111 On Edge

Table 4

RDBTABLE WITH LONG DATA VALUES (SAMPLE4) ACTUAL CONTENT

name<T>type<T>contact<T>contents<R> 10<T>4<T>21<T>20<R> Hansen<T>AAA<T>R. Starr at the UCLA & USC<T>Duplicate data under processing order number 55-7.<R> Hart<T>CCC<T>Hobbs/Emerson at RAND Corporation<T>85 files, 2 per day containing 12 and 24 hour reports.<R> Hobbs<T>EEE<T>Marshall at Universal AFB<T>Original PAF messages. Both sets are incomplete.<R> Bush<T>KKK<T>General USAF personnel<T>Duplicate ATO messages, incomplete.<R> Lender<T>RRR<T>Army base in Nevada<T>Nothing.<R> Emerson<T>UUU<T>Navy at Washington DC<T>More than we thought at first.<R>

which will produce output with the data values truncated to the defined column width as in Table 5. Using the same rdbtable with the fold option:

ptbl -fold < sample4

produces output with the long data values 'folded' within their defined column widths as shown in Table 6. Note that each line is repeated until the entire data value for each column is completely shown. This makes this type of output variable length.

If you need a quick and easy way to look at the data in an rdbtable use the -win option. This option will cause ptbl to list as many columns as possible in single line records that will fit in the current window or terminal width. Note that you do not have to type the column names (or even know them) to use this option.

Table 5

PRINTING RDBTABLE (SAMPLE4) WITH PTBL -TRUNC OPTION

name type contact contents ---------- ---- --------------------- -------------------- Hansen AAA R. Starr at the UCLA Duplicate data under Hart CCC Hobbs/Emerson at RAND 85 files, 2 per day Hobbs EEE Marshall at Universal Original PAF message Bush KKK General USAF personne Duplicate ATO messag Lender RRR Army base in Nevada Nothing. Emerson UUU Navy at Washington DC More than we thought

table 6

PRINTING RDBTABLE (SAMPLE4) WITH PTBL -FOLD OPTION

name type contact contents ---------- ---- --------------------- -------------------- Hansen AAA R. Starr at the UCLA Duplicate data under & USC processing order number 55-7. Hart CCC Hobbs/Emerson at RAND 85 files, 2 per day Corporation containing 12 and 24 hour reports. Hobbs EEE Marshall at Universal Original PAF AFB messages. Both sets are incomplete. Bush KKK General USAF Duplicate ATO personnel messages, incomplete. Lender RRR Army base in Nevada Nothing. Emerson UUU Navy at Washington DC More than we thought at first.

It may be combined with the -t option to increase the number of columns of data shown on each line at the expense of some column width. For example the command 'ptbl < d11c' on an 80 character wide window or terminal produces the following:

name count type amt n1 n3 ------ --------------- ---- ----- ------------------------ ------------ n2 n4 n5 ------------------------ ------------------------ ------------ n6 n7 ------------ ------------ Bush 3 A 133 alpha22.307 117722 baker DDBBx17 other 124567 8GGXXH17 Hansen 39 A 23 beta222.307 117723 charlie DDBBx18 data 1239870 GGXXH17 Newton 8 E 8 gama22.333 117724 dog DDBBx19 exists 1239870 GGXXH17 Hobbs 42 B 144 delta3.3.118 117725 echo DDBBx20 here 1239870 GGXXH17 Hart 2 C 55 epslion33.118 117726 foxtrot DDBBx21 also 1239870 GGXXH17

This is readable, but not very nice to look at, and even worse if there are more columns. The command 'ptbl -win < d11c' produces:

name count type amt n1 n3 ------ --------------- ---- ----- ------------------------ ------------ Bush 3 A 133 alpha22.307 117722 Hansen 39 A 23 beta222.307 117723 Newton 8 E 8 gama22.333 117724 Hobbs 42 B 144 delta3.3.118 117725 Hart 2 C 55 epslion33.118 117726

Not all the data is listed, but the first few columns (sometimes the most important) are easier to view. The command 'ptbl -win -t6 < d11c' shows even more of the data, at the expense of some data width:

name count type amt n1 n2 n3 n4 n5 n6 n7 ------ ------ ---- ----- ------ ------ ------ ------ ------ ------ ------ Bush 3 A 133 alpha2 baker 117722 DDBBx1 other 124567 8GGXXH Hansen 39 A 23 beta22 charli 117723 DDBBx1 data 123987 GGXXH1 Newton 8 E 8 gama22 dog 117724 DDBBx1 exists 123987 GGXXH1 Hobbs 42 B 144 delta3 echo 117725 DDBBx2 here 123987 GGXXH1 Hart 2 C 55 epslio foxtro 117726 DDBBx2 also 123987 GGXXH1