print_list

Package: WA2L/WinTools 1.2.08
Section: Library Commands (3)
Updated: 11 January 2009
Index Return to Main Contents

 

NAME

print_list - format CSV data to a list with dynamic column widths

 

SYNOPSIS

WA2LWinTools/lib/print_list [ -h ]

print_list [ "field_separator" [ indent ]]

 

AVAILABILITY

WA2L/WinTools

 

DESCRIPTION

the intention of this command is to print a list to a terminal in a good readable format. A CSV data provided via pipe from stdin is formatted and printed to stdout .

The first row is treated as header row. The width of all columns is dynamically adjusted to the row containing the longest column entry.

Text columns are aligned to the left, bare number columns are aligned to the right.

To select named columns from the CSV data prior to the formatting of the list with print_list use select_columns(3) .

 

OPTIONS

-h
usage message.

"field_separator"
field separator. If not specified, the default field separator is the semicolon ( ; ).

indent
left indent of the output in characters. If not specified the output is not indented.

 

ENVIRONMENT

-

 

EXIT STATUS

0
no error.

4
usage displayed.

 

FILES

-

 

EXAMPLES

1) print CSV data as formatted list

The following CSV data received via pipe

 type cities.csv
 
  ZIP;CITY;STATE;CNT;COUNTRY
  93117;Goleta;CA;USA;United States of America
  8222;Beringen;SH;CH;Switzerland
  8005;Cape Town;WC;RSA;South Africa
 
 type cities.csv | print_list

results in the output:

  ZIP    CITY       STATE  CNT  COUNTRY
  -----  ---------  -----  ---  ------------------------
  93117  Goleta     CA     USA  United States of America
   8222  Beringen   SH     CH   Switzerland
   8005  Cape Town  WC     RSA  South Africa
  (3)

2) print selected columns of CSV data as formatted list

The columns CNT, ZIP and CITY of the CSV data are selected using the select_columns(3) command and then formatted to a list using the print_list command

 type cities.csv
 
  ZIP;CITY;STATE;CNT;COUNTRY
  93117;Goleta;CA;USA;United States of America
  8222;Beringen;SH;CH;Switzerland
  8005;Cape Town;WC;RSA;South Africa
 
 type cities.csv | select_columns ";" "CNT;ZIP;CITY" | print_list


what will result in the output:


  CNT  ZIP    CITY
  ---  -----  ---------
  USA  93117  Goleta
  CH    8222  Beringen
  RSA   8005  Cape Town
  (3)

 

SEE ALSO

wintoolsintro(1), indent(3), print_header(3), print_index(3), select_columns(3)

 

NOTES

The four commands print_header(3) , select_columns(3) , print_list(3) and print_index(3) provide the functionality to efficiently produce ASCII reports having an identical look.

 

BUGS

-

 

AUTHOR

print_list was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net . 

 

COPYRIGHT

Copyright © 2020 Christian Walther

This is free software; see WA2LWinTools/man/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
ENVIRONMENT
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 16:32:44 GMT, September 14, 2024