ansifilter(1)

โœจ NAME โœจ

Okay bestie, let's talk about ansifilter ๐Ÿ’–

Ansifilter is an 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 ๐ŸŒธ

Okay so, Ansifilter is a small utility that handles text files full of ANSI terminal escape codes ๐Ÿงš The command sequences can either get stripped out or get interpreted to make formatted output (HTML, LaTeX, TeX, RTF). Iconic.

See the README file for details ๐Ÿ“–

๐ŸŽ€ File options ๐ŸŽ€

  • -i, --input=<file> (default stdin) โ€” the name of your input file ๐Ÿ“ฅ
  • -o, --output=<file> (default stdout) โ€” the name of your output file ๐Ÿ“ค
  • -O, --outdir=<dir> โ€” the name of your output directory ๐Ÿ“
  • -t, --tail โ€” keeps reading after end-of-file, kinda like tail -f. It'll use the system tail if one is available โณ
  • -x, --max-size=<size> โ€” sets the max input file size (examples: 512M, 1G; default: 256M) ๐Ÿ“
  • -n, --tee โ€” copies stdin to stdout and writes the filtered output to a file too ๐Ÿ‘ฏ
  • -b, --append โ€” appends to the output file (use with --tee) โž•

๐ŸŒˆ Output formats ๐ŸŒˆ

  • -T, --text โ€” plain text output (default) ๐Ÿ“
  • -H, --html โ€” HTML output ๐ŸŒ
  • -M, --pango โ€” Pango markup output ๐ŸŽจ
  • -L, --latex โ€” LaTeX output ๐Ÿงฎ
  • -P, --tex โ€” Plain TeX output ๐Ÿ’œ
  • -R, --rtf โ€” RTF output ๐Ÿ“„
  • -B, --bbcode โ€” BBCode output ๐Ÿ’ฌ
  • -S, --svg โ€” SVG output โœจ

๐Ÿ’… Format options ๐Ÿ’…

  • -a, --anchors(=self) โ€” adds HTML line anchors (opt: self referencing, assumes -l) โš“
  • -d, --doc-title โ€” sets the HTML/LaTeX/SVG document title ๐Ÿท๏ธ
  • -f, --fragment โ€” leaves out the HTML header and footer โœ‚๏ธ
  • -F, --font=<font> โ€” sets the HTML/RTF/SVG font face ๐Ÿ”ค
  • -k, --ignore-clear(=false) โ€” doesn't follow clear (ESC K) commands (default: true). Not me ignoring the clear stuff by default ๐Ÿ™ˆ
  • -c, --ignore-csi โ€” doesn't follow CSI commands (useful for UTF-8 input) ๐Ÿซถ
  • -A, --line-append=<s> โ€” outputs a string after each output line ๐Ÿ–Š๏ธ
  • -l, --line-numbers โ€” prints line numbers in the output file ๐Ÿ”ข
  • -m, --map=<path> โ€” reads a color mapping file (see README) ๐Ÿ—บ๏ธ
  • -r, --style-ref=<rf> โ€” sets the HTML/TeX/LaTeX/SVG stylesheet path ๐ŸŽจ
  • -s, --font-size=<num> โ€” sets the HTML/RTF/SVG font size ๐Ÿ” 
  • -e, --encoding=<enc> โ€” sets the HTML encoding, which has to match the input file encoding. Omit the encoding info if enc=NONE ๐ŸŒ
  • -p, --plain โ€” ignores the ANSI formatting info ๐Ÿซฅ
  • -w, --wrap=<len> โ€” wraps long lines ๐ŸŽ€
  • -g, --no-default-fg โ€” leaves out the default foreground color ๐Ÿฉถ
  • --no-trailing-nl โ€” leaves out the trailing newline โ†ฉ๏ธ
  • --no-version-info โ€” leaves out the version info comment ๐Ÿคซ
  • --wrap-no-numbers โ€” leaves out line numbers on wrapped lines (assumes -l) ๐Ÿ”•
  • --derived-styles โ€” outputs dynamic stylesheets (HTML/SVG) ๐Ÿช„

๐Ÿ–ผ๏ธ ASCII art options ๐Ÿ–ผ๏ธ

  • --art-cp437 โ€” parses codepage 437 ASCII art (HTML and RTF output) ๐Ÿ›๏ธ
  • --art-bin โ€” parses BIN/XBIN ASCII art (HTML output, no stdin) ๐Ÿ‘พ
  • --art-tundra โ€” parses Tundra ANSI art (HTML output, no stdin) ๐Ÿœ๏ธ
  • --art-width โ€” sets the ASCII art width (default 80) โ†”๏ธ
  • --art-height โ€” sets the ASCII art height (default 150) โ†•๏ธ

โญ OTHER OPTIONS โญ

  • -h, --help โ€” prints help ๐Ÿ†˜
  • -v, --version โ€” prints the version and license info ๐Ÿ“œ

If no input or output files are specified, stdin and stdout get used for input and output. Plain text gets generated if no output format is given. Parsing XBIN files overrides --art-width, --art-height and --map options.

Heads up, bestie ๐Ÿšจ The ANSI art file formats BIN, XBIN and TND cannot be read from stdin. Don't try it ๐Ÿ’€

๐Ÿ“ 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/.


Andre Simon really ate with this one ๐Ÿ‘‘ Last touched 2025-09-09, and that's the ansifilter(1) era, periodt ๐Ÿซถ๐Ÿ’–