ansifilter(1)

NAME
Ansifilter - ANSI escape code processor and converter

SYNOPSIS
ansifilter [d:i:F:m:o:r:s:e:fhptvHRT] [-i input file] [-o output file] [--text] [--html] [--latex] [--tex] [--rtf] [input files]

DESCRIPTION
Ansifilter is a small utility to handle text files containing ANSI terminal escape codes. The command sequences may be stripped or be interpreted to generate formatted output (HTML, LaTeX, TeX, RTF).

See the README file for details.

File options

-i, --input=<file> (default stdin)
    Name of input file

-o, --output=<file> (default stdout)
    Name of output file

-O, --outdir=<dir>
    Name of output directory

-t, --tail
    Continue reading after end-of-file (like tail -f). Use system tail if available.

-x, --max-size=<size>
    Set maximum input file size (examples: 512M, 1G; default: 256M)

-n, --tee
    Copy stdin to stdout and write filtered output to file

-b, --append
    Append to output file (use with --tee)

Output formats

-T, --text
    Output text (default)

-H, --html
    Output HTML

-M, --pango
    Output Pango markup

-L, --latex
    Output LaTeX

-P, --tex
    Output Plain TeX

-R, --rtf
    Output RTF

-B, --bbcode
    Output BBCode

-S, --svg
    Output SVG

Format options

-a, --anchors(=self)
    Add HTML line anchors (opt: self referencing, assumes -l)

-d, --doc-title
    Set HTML/LaTeX/SVG document title

-f, --fragment
    Omit HTML header and footer

-F, --font=<font>
    Set HTML/RTF/SVG font face

-k, --ignore-clear(=false)
    Do not adhere to clear (ESC K) commands (default: true)

-c, --ignore-csi
    Do not adhere to CSI commands (useful for UTF-8 input)

-A, --line-append=<s>
    Output string after each output line

-l, --line-numbers
    Print line numbers in output file

-m, --map=<path>
    Read color mapping file (see README)

-r, --style-ref=<rf>
    Set HTML/TeX/LaTeX/SVG stylesheet path

-s, --font-size=<num>
    Set HTML/RTF/SVG font size

-e, --encoding=<enc>
    Set HTML encoding (must match input file encoding); omit encoding information if enc=NONE

-p, --plain
    Ignore ANSI formatting information

-w, --wrap=<len>
    Wrap long lines

-g,  --no-default-fg
    Omit default foreground color

--no-trailing-nl
    Omit trailing newline

--no-version-info
    Omit version info comment

--wrap-no-numbers
    Omit line numbers of wrapped lines (assumes -l)

--derived-styles
    Output dynamic stylesheets (HTML/SVG)

ASCII art options

--art-cp437
    Parse codepage 437 ASCII art (HTML and RTF output)

--art-bin
    Parse BIN/XBIN ASCII art (HTML output, no stdin)

--art-tundra
    Parse Tundra ANSI art (HTML output, no stdin)

--art-width
    Set ASCII art width (default 80)

--art-height
    Set ASCII art height (default 150)

OTHER OPTIONS

-h, --help
    print help

-v, --version
    print version and license info

If no in- or output files are specified, stdin and stdout will be used for in- or output. Plain text will be generated, if no output format is given. Parsing XBIN files overrides --art-width, --art-height and --map options. The ANSI art file formats BIN, XBIN and TND cannot be read from stdin.

Examples
File conversions:

ansifilter -i text_with_ansi.txt -o text_without_ansi.txt

tail -f server.log | ansifilter

ansifilter *.txt

AUTHORS
Andre Simon <a.simon@mailbox.org>

SEE ALSO
More information at http://www.andre-simon.de/.