How to strip edit characters
Larry Wall
lwall at jpl-devvax.JPL.NASA.GOV
Fri Sep 28 04:22:37 AEST 1990
In article <2856 at idunno.Princeton.EDU> pfalstad at phoenix.Princeton.EDU (Paul John Falstad) writes:
: In article <6665 at aplcen.apl.jhu.edu> ejmag at aplcen (Magnusson Eric 859-4680) writes:
: >Is there a "shell" way to remove the backspace characters, yet retain
:
: sed /.^H/s///g
Won't work. Think what happens on "abc^H^H^H".
I wasn't going to post a sed solution because it looked to be messy, but
it would need to be something like
sed ':top
/.^H/{
s///
b top
}'
or, a little more efficiently, if there are multiple ^H fields,
sed ':top
/[^^H]^H/{
s///g
b top
}'
You ought to be able to use
sed ':top
s/[^^H]^H//g
t top'
but t is buggy some locales.
Larry
More information about the Comp.unix.shell
mailing list