🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.shell
5 messages
5 total messages Started by 4680 Thu, 27 Sep 1990 02:49
How to strip edit characters
#1248
Author: 4680
Date: Thu, 27 Sep 1990 02:49
18 lines
1105 bytes
Occasionally I receive mail from others which contains editing
characters such as backspace(^H).  When this text is printed to the
screen it appears fine, but when I try to edit it, I see all the edit
characters like sew^H^Ho (instead of "so").

Is there a "shell" way to remove the backspace characters, yet retain
the text in its final form?

One method I have successfully used on a graphics terminal is to cat
the file to the screen, and then use copy/paste from a window manager
to paste the final text into a new file.  This is ok, but I don't
always have access to a graphics workstation.

Any solutions?

-- 
Eric Magnusson
ejmag@aplcen.apl.jhu.edu
Re: How to strip edit characters
#1253
Author: Larry Wall
Date: Thu, 27 Sep 1990 03:56
19 lines
1180 bytes
In article <6665@aplcen.apl.jhu.edu> ejmag@aplcen (Magnusson Eric 859-4680) writes:
: Occasionally I receive mail from others which contains editing
: characters such as backspace(^H).  When this text is printed to the
: screen it appears fine, but when I try to edit it, I see all the edit
: characters like sew^H^Ho (instead of "so").
: 
: Is there a "shell" way to remove the backspace characters, yet retain
: the text in its final form?

Try filtering through either of

	col -b
	perl -pe '1 while s/.\010//'

The col command may do extra transmogrifications to the text that you
don't want.  The perl command may do extra transmogrifications to your
mind that you don't want.

Larry
Re: How to strip edit characters
#1251
Author: Paul John Falstad
Date: Thu, 27 Sep 1990 04:13
14 lines
1100 bytes
In article <6665@aplcen.apl.jhu.edu> ejmag@aplcen (Magnusson Eric 859-4680) writes:
>Is there a "shell" way to remove the backspace characters, yet retain

sed /.^H/s///g

You should be able to type in the ^H by typing <control-v><control-h>.
I had to fight with my terminal to keep it from sending ^?.

Perl solutions, anyone?  :-)

If Lafontaine's elk would spurn Tom Jones, the engine must be our head, the
dining car our esophagus, the guardsvan our left lung, the kettle truck our
shins, the first class compartment the piece of skin at the nape of the neck,
and the level crossing an electric elk called Simon.
Re: How to strip edit characters
#1259
Author: Larry Wall
Date: Thu, 27 Sep 1990 18:22
34 lines
1288 bytes
In article <2856@idunno.Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul John Falstad) writes:
: In article <6665@aplcen.apl.jhu.edu> ejmag@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
Re: How to strip edit characters
#1417
Author: Jeff Beadles
Date: Sat, 06 Oct 1990 03:51
16 lines
806 bytes
In <6665@aplcen.apl.jhu.edu> ejmag@aplcen (Magnusson Eric 859-4680) writes:

...
>Is there a "shell" way to remove the backspace characters, yet retain
>the text in its final form?
...

Well, for systems that have it, the "col" command works just fine.  Use it as a
pipeline, ie:

col -b < input_yuch_o_file > neat_o_file


	-Jeff
-- 
Jeff Beadles	jeff@onion.pdx.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads