Connecting Tech Pros Worldwide Forums | Help | Site Map

Filtering ansi control sequences...

Member
 
Join Date: Dec 2006
Location: Spain, Galiza, Ferrol
Posts: 48
#1: Jan 29 '09
Hi, I'm trying to write an interactive bash script. I'm using some ansi control sequences : format (color, blink,...) and cursor position, to make things easier for the administrator (also me). But now I've realized that if I want to log directly the output to a file, this file becomes more difficult to parse. Ok, I can remove relatively easily format sequences throw regexp, but cursor position movements are not so easy to "translate". I've googled for a while and found nothing.

Does someone know a cool way (gnu tool, library...) to filter ansi control sequences (there are a tone) to plain text / html (preserving format,...),...

Thanks a lot

kaarthikeyapreyan's Avatar
Member
 
Join Date: Apr 2007
Location: India
Posts: 101
#2: Feb 5 '09

re: Filtering ansi control sequences...


Am not sure if what you are looking for is this but... try using the dialog utility.
Member
 
Join Date: Dec 2006
Location: Spain, Galiza, Ferrol
Posts: 48
#3: Feb 5 '09

re: Filtering ansi control sequences...


Thanks for your reply.

It's a good idea, but I feel surer when I have all the history while scrolling in my term, I prefer avoid ncurses interfaces,... And the colored interface is good but I want my logs also colored both in console mode (tail -f, cat, grep,...) and in plain text / other formats (xml...). Any way there should be a gnu tool that simply piping could process ansi outputs and export it. I didn't found.

Reallly the best start point I found after googling some hours are webterms : anyterm (c) / ajaxterm (python adaptation). It does exactly what I searched, but I have to analyze, extract and adapt the code that I need. It process term stdout/stderr and convert to html preserving the format (colors,...). Very, very interesting tools, amazing... Next time I'll have free time, I'll try to work with this idea...

Thanks
Reply


Similar Unix / Linux / BSD bytes