Friday, September 02, 2005

sed to clean script output

#!/bin/sh
# Public domain.

# Put CTRL-M in $m and CTRL-H in $b.
# Change \010 to \177 if you use DEL for erasing.
eval `echo m=M b=H | tr 'MH' '\015\010'`

exec sed "s/$m\$//
:x
s/[^$b]$b//
t x" $*

You can also hack the sed script in script.tidy to delete some of your
terminal's escape sequences (5.8); article 41.11 explains how to find
these sequences. (A really automated script.tidy would read your
termcap or terminfo entry and look for all those escape sequences in
the script file.)

- JP

0 Comments:

Post a Comment

<< Home