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
--[no-]ignore-space  ignore space in table output
--[no-]white-space   allow white spaces at the top of each pane
--[no-]isolation     page-end line isolation
--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

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.49

DESCRIPTION

ansicolumn is a column(1) command clone which can handle ANSI terminal sequences, backspaces, and Asian wide characters. It supports traditional options and some of Linux extended, and many other 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 list, and Linux variant which has been expanded to have ritch table style output, ansicolumn(1) has been expanded to show text file in multi-column view. Combined with pagenation and document-friendly folding mechanism, it can be used as a document viewing preprocessor for pager program.

In order to accurately display the contents of the file, blank lines that were ignored by the original column(1) command are not ignored.

When multiple files are given as arguments, it gets in the parallel view mode, and show all files in parallel. It's convenient to see 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 ALISES

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

CALCULATION

As for --height, --width, --pane, --up and --pane-width options, besides giving numeric digits, you can calculate the number using terminal size. If the expression contains non-digit character, it is evaluated as an RPN (Reverse Polish Notation) with the terminal size pushed on the stack. Initial value for --height options is terminal height, and 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 same. See `perldoc Math::RPN` for the expression detail.

Next example select number of panes by dividing terminal width by 85:

ansicolumn --pane 85/

If you consider the case the terminal width is less than 85:

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

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

STARTUP

This command is implemented with Getopt::EX module. So

~/.ansicolumnrc

file is read at start up time. If you want use --no-white-space always, put this line in your ~/.ansicolumnrc.

option default --no-white-space

Also command can be extended by original modules with -M option. See `perldoc Getopt::EX` for detail.

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.