# phpman > man > showtable(1p)

[SHOWTABLE(1p)](https://www.chedong.com/phpMan.php/man/SHOWTABLE/1p/markdown)                    User Contributed Perl Documentation                   [SHOWTABLE(1p)](https://www.chedong.com/phpMan.php/man/SHOWTABLE/1p/markdown)



## NAME
       showtable - Show data in nicely formatted columns

## USAGE
       **showtable** [-_options_] [_file_]

## DESCRIPTION
       **Showtable** reads an input data stream and displays it in a nicely formatted listing, with
       exact formatting depending upon the options.  The input stream, _file_ or "STDIN" by default
       should consist of data separated by tabs or the defined _separator_ character (see **-d**).

       The actual output formatting is peformed by the **ShowTable** module.

## OPTIONS
       There are two general sets of options: those which help determine the format of the input,
       and those which determine the format of the output.

### Options affecting input
### -break=
                 Set the inter-column break string to "_str_".  The default is a tab (""\t"").  If
                 **-strip** is also given, blanks surrounding the break string will also be ignored.

### -d

### -nod(ashes)
                 Do not ignore lines of separators, such as dashes, equal signs, or underlines.  If
                 **-nodashes** is given, and these lines do occur in the stream, they will be treated as
                 normal data.

### -ti(tles)[=
                 Treat the first _NN_ rows of data as column titles; multiple words in the column
                 titles may wrap vertically. If _NN_ is omitted, it defaults to 1.  No **-titles** option
                 is the same as **-titles=0**.

### -in(put)=
                 Set the input type as _type_, which can be one of: _box_, _list_, _table_, or _simple_.  A
                 _simple_-type table is the same as a _table_-type, but no wrapping characters are
                 recognized.

### -s(trip)

### -nos(trip)
                 Do not strip blanks from the input.  Useful if there is formatted or aligned data
                 within a boxed table.

### Options affecting output
### -t(able)
                 or determined column widths.  See [Data::ShowTable](https://www.chedong.com/phpMan.php/perldoc/Data%3A%3AShowTable/markdown) for more details.

### -si(mple)
                 [Data::ShowTable](https://www.chedong.com/phpMan.php/perldoc/Data%3A%3AShowTable/markdown) for more details.

### -l(ist)

### -b(ox)

### -ht(ml)

### -ti(tles)=
                 Define the column names explicitly.  This is useful for naming columns of data from
                 "STDIN", when **showtable** is being used as a filter.  The first column name, _name1_,
                 cannot begin with a digit.  This option allows any column titles obtained from the
                 input to be overridden.

### -noh(eaders)
                 Do not output any headers on the tables; **-titles=0** implies this option.

### -f
                 Select fields numbered _n1_, _n2_, etc., to display.  Each _nN_ is a field index, or a
                 range of indexes in the form: "N"-"M" The default is to show all the fields in each
                 row.  Fields are numbered from 1.  An example:  to show the first, and three
                 through five fields of the "/etc/passwd" file:

                     showtable -d: -f1,2-5 /etc/passwd

### -fields
                 Select the named fields to display.  The field names must be available, either
                 through the data stream, or by using the **-titles** option.   The field names given
                 must match the existing field names _exactly_.

                 Using the file "/etc/passwd" for another example: to show the same first two
                 fields, by name:

                     showtable -d: -titles=Login,UID -fields=Login,UID /etc/passwd

### -w(idth)
                 Set the maximum table width.  This value is applied to the variable
                 [Data::Showtable::Max_Table_Width](https://www.chedong.com/phpMan.php/perldoc/Data%3A%3AShowtable%3A%3AMaxTableWidth/markdown).  When the total width of all columns to be
                 displayed exceeds this value, all column widths are scaled uniformly.

                 If **-width** is not given, then for all output but **-html**, the default value is either
                 ""COLUMNS"", if defined, or 80, if not.  Whith **-html** mode, there is no default
                 value for **-width**; in other words, there is no limit to the width.

### -cw(idths)
                 Set individual column widths to the specified values.  Empty column widths imply no
                 maximum width.  If the **-width** option is also given, then the **-cwidth** column widths
                 can also be given as fractions or percentages.

                 Example: To set the maximum width of the third column to 20 characters:

                     -cw=,,20

### HTML-only options (the usage of which implies -html)
### -noe(scape)
                 Do not perform HTML escape sequences on the data; this allows embedded HTML text in
                 the data to be displayed properly with the **-html** option.

### -attributes
                 Declare the table attributes, which are inserted into the "TABLE" token.  For
                 example, the option:

                     -attributes='BORDER=0 CELLSPACING=2 CELLPADDING=4'

                 would cause the following HTML:

                     <TABLE BORDER=0 CELLSPACING=2 CELLPADDING=4>

                 The default table attributes are:

                     <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>

### -t(itle)
                 Set the HTML formats for the column titles.  The **-title**___**formats** (or just **-tf**) can
                 be given multiple times, for each column, or formats for multiple columns can be
                 given on the same option separated by semi-colons "";"".

                 Each _fmtN_ can itself be multiple HTML items, separated by commas.  Each HTML
                 element can be given either as an HTML token (eg: ""\<BOLD\">"), or as a plain name
                 (eg: ""BOLD"").

                 For example, here is a title format specification for three columns, where the
                 first column title should be bold italic, the second italic, and the third italic
                 in a smaller font:

                         -tf='BOLD,I;I;<FONT SIZE=-2>,I'

### -d(ata)
                 The same as **-title**___**formats** but applies to the column data.

### -url(s)=
                 Define a mapping from column names, or indexes, to URLs to be inserted as <A
                 HREF's> around the values for the named columns.  Each _colN_ is a column name or
                 index, and each _urlN_ is a string representing the URL to be inserted for the given
                 column.

                 The URL text may contain these substitution strings:

                 **%K** - will be substituted with the current column name (or _key_).

                 **%V** - will be substituted with the current column value.

                 Multiple **-url** options may be given, if desired, rather than creating one long
                 argument for a single **-url**.  For example:

                     showtable   -d: -f1,6 -titles=Login,Homedir \
                                 -url='Login=mailto:%V' \
                                 -url='HomeDir=file:%V' \
                                 /etc/passwd

### Other options
### -help

### Boxed Input
       If the input type is _box_, then vertical and horizontal box characters are removed from the
       input stream, and blanks surrounding the vertical box characters are removed.  The vertical
       box characters (column separaters) are ""|"" or "":"".  The The horizontal box characters are
       ""+"" and ""-"".

       Morever, data wrapped within a column is recognized and parsed as one column value, by
       recognizing the presence of a _wrapping_ _prefix_ or _wrapping_ _suffix_ character.  Currently, the
       wrapping prefix character is "<", and the wrapping suffix character is ">".

       An example of data wrapped within a column is given here.  The table below has just two
       _logical_ rows of data; with both rows having data wrapped into multiple _physical_ rows.

               +---------+---------+---------+
               |  Col 1  |  Col 2  |  Col 3  |
               +---------+---------+---------+
               | This is>| Another>| Row 1,3>|
               |< a cont>|< value. |<is also>|
               |<inued  >|         |<long.   |
               |<value.  |         |         |
               |This is >| Item2-2 | Item2-3 |
               +---------+---------+---------+

### List Format
       When using the **-list** or **-input=list** options, either, or both, the input and output may be in
       a "list" format, which is implemented using the following syntax:

               r1c1_name: r1c1_value
               r1c2_name: r1c2_value
               ...
               r1cN_name: r1cN_value

               r2c1_name: r2c1_value
               r2c2_name: r2c2_value
                        : r2c2_value_continued
               ...
               r2cN_name: r2cN_value

               rMc1_name: rMc1_value
               rMc2_name: rMc2_value
               ...
               rMcN_name: rMcN_value

       Each _row_ of data consists of one or more _columns_, and ends with a blank line.

       Each _column_ consists of a _column_ _name_, followed by a colon ":", followed by an optional,
       single space or tab, followed by the _column_ _value_, on the same line.

       Continuation lines of the previous column value consist of one or more space or tab
       characters, a colon ":", one optional, single space or tab, followed by the continuation
       value.  In the example above, The second column value of the second row was continued.

### HTML Input with HTML Output
       When using **-html** on data already containing HTML-formatted text, the **-noescape** option should
       be used.  By default, all input text is assumed _not_ to be HTML-formatted, and is escaped
       allowing embedded "<", ">" characters, if any, to be displayed correctly.

## DEPENDENCIES
       [**Data::ShowTable**](https://www.chedong.com/phpMan.php/perldoc/Data%3A%3AShowTable/markdown) module
                 Performs the actual output formatting.

## AUTHOR
       Alan K. Stebbens <_aks@stebbens.org_>

## BUGS
       •    Currently, the box formatting characters are not configurable: '+' for the corners; '-'
            and '|' for the tops and sides, respectively.  In an ideal world, these things would be
            configurable.

       •    The continuation prefix and suffix characters, '<' and '>', respectively, are also not
            configurable:

       •    When reading _table_ input, any data ending with ">" will be considered to be continued by
            the next row of data.  To avoid this, use **-input=simple**.

       •    When selecting noncontiguous fields (ie: **-f1,4**>) without field names, the default field
            names will be consecutively numbered from 1, which is counter-intuitive to the original
            selection.  To avoid this, name the fields using the **-title=...**  option.



perl v5.32.0                                 2021-01-06                                [SHOWTABLE(1p)](https://www.chedong.com/phpMan.php/man/SHOWTABLE/1p/markdown)
