Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jan 2004 10:42:43 +0100
From:      Bernard El-Hagin <zaphod@neostrada.pl>
To:        freebsd-questions@freebsd.org
Subject:   Re: perl script question.
Message-ID:  <20040111094243.GA1114@hoth>
In-Reply-To: <20040110233645.GA5668@happy-idiot-talk.infracaninophile.co.uk>
References:  <20040110221036.GA44130@tao.thought.org> <20040110223308.GA4881@happy-idiot-talk.infracaninophile.co.uk> <20040110223907.GA16659@Uruk-Hai.Sanitarium.mine.nu> <20040110230218.GA5347@happy-idiot-talk.infracaninophile.co.uk> <6.0.0.22.0.20040110182450.0a09ce58@pop.face2interface.com> <20040110233645.GA5668@happy-idiot-talk.infracaninophile.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Seaman wrote:
> On Sat, Jan 10, 2004 at 06:26:30PM -0500, Marty Landman wrote:
> > At 06:02 PM 1/10/2004, Matthew Seaman wrote:
> > >On Sat, Jan 10, 2004 at 11:39:07PM +0100, Bj?rn Andersson wrote:
> > >
> > >> If this occures more than once on a line we should have the line as this:
> > >>   perl -pi.bak -e 's/\s+\w+_\w+\.?//g;' filename
> > >
> > >Good point.  Also, if the stuff_separated_by_underscores wraps around
> > >onto more than one line, then there may not be any leading whitespace:
> > 
> > I don't see why the translate sol'tn that Gary Kline gave first isn't 
> > adequate.
> 
> Err --- Gary Kline was the OP asking how to do this: I think you mean 
> Bernard El-Hagin's solution?
> 
>     % perl -i.bak -pe 'tr/_/ /' <files>
> 
> That doesn't do the right thing.  It turns:
> 
>     "This is a sample ordinary sentence.  This_is_joined_up_with_underscores."
> 
> into:
> 
>     "This is a sample ordinary sentence.  This is joined up with underscores."
> 
> but the requirement is to produce:
> 
>     "This is a sample ordinary sentence."


Yes, I completely misread the question. Sorry.

-- 
Cheers,
Bernard



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040111094243.GA1114>