Actions Status MetaCPAN Release

NAME

ansicolumn - ANSI terminal sequence aware column command

SYNOPSIS

ansicolumn [options] [file ...]

-w#, -c#             output width
-s#                  separator string
-l#                  maximum number of table columns
-x                   exchange rows and columns
-o#                  output separator

-P[#], --page=#      page mode, with optional page length
       --no-page     disable page mode
-U[#], --up=#        show in N-up format (-WC# --linestyle=wrap)
--2up .. --9up       same as -U2 .. -U9
-D,  --document      document mode
-V,  --parallel      parallel view mode
-H,  --filename      print filename header in parallel view mode
-I,  --ignore-empty  ignore empty files
-X#, --cell=#        set text width for files in parallel view mode
-C#, --pane=#        number of panes
-S#, --pane-width=#  pane width
-W,  --widen         widen to terminal width
-p,  --paragraph     paragraph mode
-r,  --regex-sep     treat separator string as regex

-B,  --border[=#]    print border with optional style
-F,  --fillup[=#]    fill-up unit (pane|page|none)

--height=#           page height
--column-unit=#      column unit (default 8)
--margin=#           column margin width (default 1)
--linestyle=#        folding style (none|truncate|wrap|wordwrap)
--boundary=#         line-end boundary
--linebreak=#        line-break mode (none|all|runin|runout)
--runin=#            run-in width
--runout=#           run-out width
--runlen=#           set both run-in and run-out width
--[no-]pagebreak     allow page break
--border-style=#     border style
--label POS=TEXT         pane border label
--page-label POS=TEXT    page border label
--[no-]ignore-space  ignore space in table output
--[no-]white-space   allow white spaces at the top of each pane
--[no-]isolation     page-end isolated line
--tabstop=#          set tab width
--tabhead=#          tab-head character
--tabspace=#         tab-space character
--tabstyle=#         tab style
--ambiguous=#        ambiguous character width (narrow|wide)
--pages              split file by formfeed
--colormap=#         color mapping (LABEL=COLOR)

Table style options:

-t,  --table           table style output
-A,  --table-align     align table output to column unit
-T,  --table-tabs      align items by tabs
-TT                    reformat tab aligned text
-R#, --table-right=#   right adjust table columns
     --table-center=#  center table columns
-K#, --table-remove=#  discard specified columns
     --item-format=#   apply sprintf format to each cell
     --table-squeeze   remove all-empty columns
     --padding         pad last column to full width

Default alias options:

--board-color FG BG    board style pages with FG and BG colors
--white-board          black on white board
--black-board          white on black board
--green-board          white on green board
--slate-board          white on dark slategray board

VERSION

Version 1.5702

DESCRIPTION

ansicolumn is a column(1) command clone that can handle ANSI terminal sequences, backspaces, and Asian wide characters. It supports traditional options, some of the Linux extended options, and many of its own original options.

In addition to normal operation, table style output (-t) is supported as well.

In contrast to the original column(1) command which handles mainly short item lists, and the Linux variant which has been expanded to have rich table style output, ansicolumn(1) has been expanded to show text files in a multi-column view. Combined with pagination and a document-friendly folding mechanism, it can be used as a document viewing preprocessor for a pager program.

To accurately display file contents, blank lines that were ignored by the original column(1) command are preserved.

When multiple files are given as arguments, it enters parallel view mode and shows all files in parallel. This is convenient for viewing multiple files side-by-side.

COMPATIBLE OPTIONS

The column utility formats its input into multiple columns. Rows are filled before columns. Input is taken from file operands, or, by default, from the standard input.

EXTENDED OPTIONS

DEFAULT ALIASES

The following options are defined in App::ansicolumn::default.pm.

CALCULATION

For the --height, --width, --pane, --up and --pane-width options, besides giving numeric digits, you can calculate the number using the terminal size. If the expression contains a non-digit character, it is evaluated as an RPN (Reverse Polish Notation) expression with the terminal size pushed on the stack. The initial value for --height is the terminal height, and the terminal width for others.

OPTION              VALUE
=================   =========================
--height 1-         height - 1
--height 2/         height / 2
--height 1-2/       (height - 1) / 2
--height dup2%-2/   (height - height % 2) / 2

Space and comma characters are ignored in the expression. So 1-2/ and 1 - 2 / and 1,-,2,/ are all the same. See perldoc Math::RPN for details.

The next example selects the number of panes by dividing the terminal width by 85:

ansicolumn --pane 85/

If you need to handle the case where the terminal width is less than 85:

ansicolumn --pane 85/,DUP,1,GE,EXCH,1,IF

This RPN means $width/85 >= 1 ? $width/85 : 1.

STARTUP

This command is implemented with the Getopt::EX module, so the

~/.ansicolumnrc

file is read at startup. If you always want to use --no-white-space, put this line in your ~/.ansicolumnrc:

option default --no-white-space

The command can also be extended with custom modules using the -M option. See perldoc Getopt::EX for details.

INSTALL

CPANMINUS

$ cpanm App::ansicolumn

To get the latest code, use this:

$ cpanm https://github.com/tecolicom/App-ansicolumn.git

EXAMPLES

https://github.com/tecolicom/App-ansicolumn/tree/master/images

SEE ALSO

https://github.com/tecolicom/ANSI-Tools

column(1), https://man7.org/linux/man-pages/man1/column.1.html

App::ansicolumn, https://github.com/tecolicom/App-ansicolumn

Text::ANSI::Printf, https://github.com/tecolicom/Text-ANSI-Printf

Articles (in Japanese)

RELATED WORKS

https://github.com/LukeSavefrogs/column_ansi

AUTHOR

Kazumasa Utashiro

LICENSE

Copyright © 2020-2026 Kazumasa Utashiro.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.