Loading

Paste #pywyyphys

  1. #!/bin/sh
  2. # capture output in terminal of same size using:
  3. # TERM=xterm-256color script -q -c 'tmux attach -t 0 \; detach' outputfile
  4. # todo: obtain correct size from tmux and fake it
  5. # note: \x1b in sed is a GNU extension and not posix-compliant
  6. sed '
  7. ## strip everyting before jump to first column (titlebar escapes etc.)
  8. s|^.*\x1b\[1;1H||;
  9.  
  10. ## convert cursor jumps into newlines (happen at fully filled lines)
  11. s|\x1b\[[0-9]\+;[0-9]\+H|\n|g;
  12.  
  13. ## some stuff left at the end (cursor position etc.)
  14. s|\x1b\[[0-9]\+;[0-9]\+r||g;
  15. s|\x1b\[H||g;
  16. # s|\x1b\[\?[0-9]\+l||;
  17. # s|\x1b\[\?[0-9]\+g||;
  18. ' | ansifilter -e utf8 -H | \
  19. sed 's/<body>/<body style="color: silver; background-color:black;">/'
  20.