tabler is a nice utility to have, it will comes in handy to have a perfect drawn ASCII table from plain text like other program’s output. For example,

$ free -m | tabler -i
+-------+----------------+------+------+--------+---------+--------+
|       | total          | used | free | shared | buffers | cached |
+-------+----------------+------+------+--------+---------+--------+
| Mem:  | 2010           | 1981 | 28   | 0      | 13      | 1157   |
| -/+   | buffers/cache: | 810  | 1199 |        |         |        |
| Swap: | 1913           | 0    | 1913 |        |         |        |
+-------+----------------+------+------+--------+---------+--------+

The output of free command for memory usage information has been transformed into an ASCII table without any efforts required. -i tells tabler that the first line of input is the header line.

More conversions on common command-line tools:

$ df -m | tabler -i
+-------------+-----------+-------+-----------+------+----------------+----+
| Filesystem  | 1M-blocks | Used  | Available | Use% | Mounted        | on |
+-------------+-----------+-------+-----------+------+----------------+----+
| rootfs      | 73197     | 53449 | 19245     | 74%  | /              |    |
| /dev/sda3   | 73197     | 53449 | 19245     | 74%  | /              |    |
| tmpfs       | 1006      | 1     | 1005      | 1%   | /run           |    |
| udev        | 10        | 0     | 10        | 0%   | /dev           |    |
| shm         | 1006      | 1     | 1006      | 1%   | /dev/shm       |    |
| cgroup_root | 10        | 0     | 10        | 0%   | /sys/fs/cgroup |    |
| /dev/sda1   | 38        | 6     | 31        | 16%  | /boot          |    |
| none        | 1508      | 1     | 1508      | 1%   | /tmp           |    |
+-------------+-----------+-------+-----------+------+----------------+----+

$ du -h | tabler
+------+--------------------+
| 12K  | ./2013/__pycache__ |
| 64K  | ./2013/onhold      |
| 748K | ./2013             |
| 172K | ./2008             |
| 244K | ./2012             |
| 180K | ./2011             |
| 424K | ./2010             |
| 928K | ./published        |
| 240K | ./2009             |
| 2.9M | .                  |
+------+--------------------+

$ ps o user,pid,rss,command | tabler -i
+----------+-------+--------+----------------------+--------------+---------------------------------------+----+
| USER     | PID   | RSS    | COMMAND              |              |                                       |    |
+----------+-------+--------+----------------------+--------------+---------------------------------------+----+
| livibet+ | 2047  | 1196   | tmux                 | -2           |                                       |    |
| livibet+ | 2050  | 2984   | -bash                |              |                                       |    |
| livibet+ | 2087  | 9792   | /usr/bin/vim         | --servername | VIM                                   |    |
| livibet+ | 2096  | 3088   | -bash                |              |                                       |    |
| livibet+ | 2289  | 2936   | /bin/bash            | --rcfile     | /home/livibetter/share/bashrun/bashrc | -i |
| livibet+ | 2427  | 307076 | /opt/firefox/firefox | --no-remote  |                                       |    |
| livibet+ | 2815  | 276068 | /opt/firefox/firefox | --no-remote  |                                       |    |
| livibet+ | 4753  | 2984   | -bash                |              |                                       |    |
| livibet+ | 7296  | 1216   | ps                   | o            | user,pid,rss,command                  |    |
| livibet+ | 7297  | 608    | tabler               | -i           |                                       |    |
| livibet+ | 13953 | 4100   | /usr/bin/mc          |              |                                       |    |
| livibet+ | 13960 | 2400   | bash                 | -rcfile      | .bashrc                               |    |
| livibet+ | 14936 | 3108   | -bash                |              |                                       |    |
| livibet+ | 21444 | 3040   | -bash                |              |                                       |    |
| livibet+ | 21469 | 56472  | rtorrent             |              |                                       |    |
+----------+-------+--------+----------------------+--------------+---------------------------------------+----+

There is an issue from the last example, the arguments of commands are tabularized as columns or fields. It might be resolvable, but it would take some efforts.

tabler can be used for CSV files, sort of. If the CSV is very simple. The following sample data is taken from Wikipedia page:

$ cat test.csv
Year,Make,Model
1997,Ford,E350
2000,Mercury,Cougar

$ tabler -F ',' -i test.csv
+------+---------+--------+
| Year | Make    | Model  |
+------+---------+--------+
| 1997 | Ford    | E350   |
| 2000 | Mercury | Cougar |
+------+---------+--------+

Interestingly, you can use the output of tabler as reStructuredText simple table syntax without or with -b for changing decoration characters for header line:

$ tabler -F ',' -i test.csv -b '= = = = = =    '
======= ========= ========
  Year   Make      Model
======= ========= ========
  1997   Ford      E350
  2000   Mercury   Cougar
======= ========= ========

$ tabler -F ',' -i test.csv -b '= = = = = =    ' | rst2html.py
[snip]
<table border="1" class="docutils">
<colgroup>
<col width="29%" />
<col width="38%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Year</th>
<th class="head">Make</th>
<th class="head">Model</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>1997</td>
<td>Ford</td>
<td>E350</td>
</tr>
<tr><td>2000</td>
<td>Mercury</td>
<td>Cougar</td>
</tr>
</tbody>
</table>
[snip]

Here is live rendering from rst2html.py result:

Year Make Model
1997 Ford E350
2000 Mercury Cougar

I am sure that you can adjust the decoration to suit the Markdown table extension syntax.

If the input can be formatted, then it should be no problem to use with tabler. The next example lists some installed packages:

$ PRINT_COUNT_ALWAYS=never \
  INSTFORMAT='<version>{!last}\t{}' \
  eix --format '<category>\t<name>\t<description>\t<installedversions:INSTFORMAT>\t\n' -I gentoo | \
  tabler -F '\t'
+-------------+-----------------+----------------------------------------------------------------------------------------------+-------------+-----------+
| app-portage | gentoolkit      | Collection of administration scripts for Gentoo                                              | 0.3.0.7     |           |
| app-shells  | gentoo-bashcomp | Gentoo-specific bash command-line completions (emerge, ebuild, equery, repoman, layman, etc) | 20101217-r1 |           |
| app-vim     | gentoo-syntax   | vim plugin: Gentoo and portage related syntax highlighting, filetype, and indent settings    | 20130619    |           |
| sys-kernel  | gentoo-sources  | Full sources including the Gentoo patchset for the 3.11 kernel tree                          | 3.10.7      | 3.10.7-r1 |
+-------------+-----------------+----------------------------------------------------------------------------------------------+-------------+-----------+

I think tabler does bring some ASCII table art into terminal windows and it might be worth piping outputs to it for nicer presentations. The only drawback is tabler can’t work with Unicode stuff, for instance, having Unicode Box-drawing character as decorations. If it could, then we would have more prettier tables, although that’s really an excess.

The last code commit was more than five years ago (2008-07-10), hopefully, one day, it will become active again and the author hnc (Heath Caldwell) continues the development.