Ansifilter documentation
Ansifilter documentation
Imagine you want to read some logfiles from a UNIX or Linux based program and you get the following:
This is a text file containing ANSI codes, which are used to output formatted text
in UNIX or Linux terminals. This is nice as long as your terminal supports these
codes, but what to do if you use a Windows editor? What to do if the developer
adjusted the colours of the logging output to suit his yellow-on-green coloured terminal, but you
have a black-on-white setup?
You can't solve all problems by installing Cygwin, so ansifilter comes to the rescue:
These screenshots show the Windows and Linux versions of the GUI, which displays a ANSI cluttered file.
Ansifilter strips ANSI codes or converts them to HTML, TeX, LaTeX, RTF or BBCode if you want to preserve the formatting information.
The utility is also available as command line interface:
ansifilter ansifile.txt will give:
Several ANSI codes: Bold Underline Black Red Green Red Background Green Background Image inverted and back
ansifilter --html ansifile.txt will give:
Several ANSI codes: Bold Underline Black Red Green Red Background Green Background Image inverted and back
Features
These are the options of the command line interface:
File handling:
-i, --input=<file> name of single input file
-o, --output=<file> name of single 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
Output text formats:
-T, --text (default) Output text
-H, --html Output HTML
-L, --latex Output LaTeX
-P, --tex Output Plain TeX
-R, --rtf Output RTF
-B, --bbcode Output BBCode
Formatted text options:
-d, --doc-title Set HTML/LaTeX document title
-e, --encoding Set HTML encoding (must match input file encoding)
-f, --fragment Omit HTML header and footer
-F, --font=<font> Set HTML/RTF font face
-r, --style-ref=<rf> Set HTML/TeX/LaTeX stylesheet path
-s, --font-size<fs> Set HTML/RTF font size
-p, --plain Ignore ANSI formatting information
Other options:
-h, --help Print help
-v, --version Print version and license info
Examples:
ansifilter -i text_with_ansi.txt -o text_without_ansi.txt
ansifilter *.txt
tail -f server.log | ansifilter
The GUI version also accepts the first command line argument as input file name.
Supported control sequences
Formatting:
Bold, Underline, Italic, Blink
Colors:
Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, xterm 256 color codes
Other:
Conceal/Reveal, Image positive/negative
