🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1259

Re: How to strip edit characters

#1259
From: 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
Technical Details
Message-ID: <9712@jpl-devvax.JPL.NASA.GOV>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!timbuk!cs.umn.edu!msi-s0.msi.umn.edu!srcsip!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall
References: <6665@aplcen.apl.jhu.edu> <2856@idunno.Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!timbuk!cs.umn.edu!msi-s0.msi.umn.edu!srcsip!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall
From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall)
Newsgroups: comp.unix.shell
Subject: Re: How to strip edit characters
Message-ID: <9712@jpl-devvax.JPL.NASA.GOV>
Date: 27 Sep 90 18:22:37 GMT
References: <6665@aplcen.apl.jhu.edu> <2856@idunno.Princeton.EDU>
Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall)
Distribution: na
Organization: Jet Propulsion Laboratory, Pasadena, CA
Lines: 34