Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2004 23:39:07 +0100
From:      =?iso-8859-1?Q?Bj=F6rn?= Andersson <gaqzi@sanitarium.mine.nu>
To:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Cc:        Gary Kline <kline@thought.org>
Subject:   Re: perl script question.
Message-ID:  <20040110223907.GA16659@Uruk-Hai.Sanitarium.mine.nu>
In-Reply-To: <20040110223308.GA4881@happy-idiot-talk.infracaninophile.co.uk>
References:  <20040110221036.GA44130@tao.thought.org> <20040110223308.GA4881@happy-idiot-talk.infracaninophile.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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

Notice the added g. :-)

On Sat, Jan 10, 2004 at 10:33:08PM +0000, Matthew Seaman wrote:
> On Sat, Jan 10, 2004 at 02:10:36PM -0800, Gary Kline wrote:
> > 
> > 	Folks,
> > 
> > 	Let's see if perl can do this one; it's as obscure a task
> > 	as I've run into.  I have scores of files with:
> > 
> > 	A regular sentence, or phrase. then_one_containing_underscores_-
> > 	between_each_word  Followed by another regular, space-delimited
> > 	sentence.  Followed_by_another_string_with_underscaores.
> > 
> > 	Is there a perl way to get rid of the
> > 	string_containing_underscores and leave the regular sntences??
> > 
> 
>     perl -pi.bak -e 's/\s+\w+_\w+\.?//;' filename
> 
> 	Cheers,
> 
> 	Matthew	
> 
> -- 
> Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
>                                                       Savill Way
> PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
> Tel: +44 1628 476614                                  Bucks., SL7 1TH UK




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