Filtering ansi control sequences...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vituko
    New Member
    • Dec 2006
    • 48

    Filtering ansi control sequences...

    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
    New Member
    • Apr 2007
    • 106

    #2
    Am not sure if what you are looking for is this but... try using the dialog utility.

    Comment

    • vituko
      New Member
      • Dec 2006
      • 48

      #3
      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

      Comment

      Working...