table(1) - Command line utility to format and display CSV.

0.7.4, 16 Apr 2024

#Command Aliases

tablep is a synonym for table -p.
tsvtable is a synonym for table -d "$(printf '\t')" -q ignore.


table [-h | --help]

table [-v | --version]

table [-a| --align=alignment] [-b| --border-mode] [-c| --columns=cols] [-D| --align-dot]

[-d|--delimiter= delim] [-f | --format= format] [-H | --align-header] [-m | --msdos] [-n | --no-ansi] [-p | --pause] [-q | --quotes= behavior] [-s | --symbols= set] [-t | --expand-tabs] [-y | --yes-ansi] [pathname]

table Copyright © 2020-2024 Strahinya Radich.
This program is licensed under GNU GPL v3 or later. See the file LICENSE in the table repository for details.


table is a command line utility to format and display CSV. It parses the given file or standard input as CSV and prints out a table using Unicode characters for box drawing.

When specifying multiple pathname arguments, table prints a warning to stderr. Only the first such argument is processed. If pathname is omitted, table reads standard input.


-a alignment

Set column alignments. alignment is a string consisting of characters l, c or r, which respectively set the alignment of the corresponding column to left, center or right. For example, -arccc sets the alignment for the first column to right, and the next three columns to center.


Border mode: force single column.

-c cols

Set maximum table width in columns (default 80).


Set alignment character to dot "." instead of a space " ".

-d delim

Set field delimiter (default ","). First line of the input determines the number of table columns. The first character of delim becomes the delimiter. Special characters, like ";", need to be quoted or escaped:

$ table -d';'


$ table -d\;

In the examples above, "'" and "\" are parsed by the shell and are not passed to table, so are not considered as "first characters" for the assignment.

Note that the -b parameter takes precedence: if it is present, -d is ignored.

-f format

Set widths for individual columns as ratio. Parameter format should be a string of weights separated by colons. For example:

$ table -c 50 -s aa examples/quotes-english.csv
|ID         |Name       |Surname    |Age        |
|001        |John       |Smith      |34         |
|002        |Steven     |Watson     |23         |
|003        |Richard    |Smith      |33         |
|007        |Bond, James|Bond       |46         |
$ table -f 1:2:3:4 -c 50 -s aa examples/quotes-english.csv
|ID  |Name     |Surname      |Age               |
|001 |John     |Smith        |34                |
|002 |Steven   |Watson       |23                |
|003 |Richard  |Smith        |33                |
|007 |Bond, Jam|Bond         |46                |
$ table -f 1:5:5:1 -c 50 -s aa examples/quotes-english.csv
|ID  |Name              |Surname           |Age |
|001 |John              |Smith             |34  |
|002 |Steven            |Watson            |23  |
|003 |Richard           |Smith             |33  |
|007 |Bond, James       |Bond              |46  |


Makes the column alignment also apply to header row. The default behavior is to print header cells left-aligned.


Print the usage information screen.


Ignore carriage return (\r) characters in input. The default behavior is to treat them as part of the text, which can produce unexpected results.


Turn off ANSI SGR codes in the output. By default, the header row is printed in bold using ANSI codes if the stdout is a tty. This switch prevents that.


Presents the message "Press Enter to continue" and waits for input after outputting the table. This accounts for executing table from file managers which don't pause after executing programs or as a single command from terminal emulators.

-q behavior

behavior can be one of the following:


Treats everything between the quotes as a single column. Treats consecutive quotes within the quoted text as literal quotes. This is the default.


Ignores the special meaning of quotes (like TSV). This is the default if table is called as tsvtable.

-s set

Use table symbol set set for table lines, where set is one of the following (format: <border><inner border>):

aa ascii-ascii,
ss single-single,
sd single-double,
ds double-single (default),
dd double-double,
ee empty-empty,
ae ascii-empty,
se single-empty,
de double-empty,
ea empty-ascii,
es empty-single,
ed empty-double.


Expand tabs to spaces, honoring standard modulo 8 tab stops. Default behavior is to output tab characters as-is.

Note that the -d parameter takes precedence, unless -b is also used: if the delimiter is set to the TAB character (0x09), -t is ignored. When -b is used in addition, -t is honored and -d ignored.


Print program version and exit.


Explicitly turn on ANSI SGR codes in the output. By default, the header row is printed in bold using ANSI codes, unless the stdout is not a tty. This switch enforces the output of ANSI SGR codes, even in that case.

#See Also

awk(1), sed(1)


Periodically display CPU load information in a single-line table

$ watch "table /proc/loadavg -d ' ' -c 50 -n -s ss"

Format a long list of files in the current directory in a double line table with single-line column divisors

$ LC_ALL=C ls -l | tail -n +2 | sed -e 's/ \+/ /g' | table -d ' ' -n

Print information from /etc/passwd in a table:

$ table -n -d : -f 3:1:1:1:4:4:4 /etc/passwd

Same as above, without borders and with different column alignment:

$ table -n -H -d: -arccclll -see -f3:1:1:1:4:4:4 /etc/passwd


Strahinya Radich, https://strahinja.org


Bugs can be reported using the ticket tracker at: https://todo.sr.ht/~strahinja/table

About this wiki

commit e60044919d8c09592d68c7835cf5dad29250b21d
Author: Страхиња Радић <contact@strahinja.org>
Date:   2024-04-16T18:49:27+02:00

Update to 0.7.4

Signed-off-by: Страхиња Радић <contact@strahinja.org>
Clone this wiki
https://git.sr.ht/~strahinja/table (read-only)
git@git.sr.ht:~strahinja/table (read/write)