From owner-freebsd-questions@FreeBSD.ORG Sat Jan 10 14:38:25 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 11CB716A4CE for ; Sat, 10 Jan 2004 14:38:25 -0800 (PST) Received: from Uruk-Hai.Sanitarium.mine.nu (h14n2fls35o917.telia.com [217.211.25.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4D8C43D1D for ; Sat, 10 Jan 2004 14:38:23 -0800 (PST) (envelope-from gaqzi@Uruk-Hai.Sanitarium.mine.nu) Received: by Uruk-Hai.Sanitarium.mine.nu (Postfix, from userid 1001) id 5E66D593; Sat, 10 Jan 2004 23:39:07 +0100 (CET) Date: Sat, 10 Jan 2004 23:39:07 +0100 From: =?iso-8859-1?Q?Bj=F6rn?= Andersson To: FreeBSD Mailing List Message-ID: <20040110223907.GA16659@Uruk-Hai.Sanitarium.mine.nu> Mail-Followup-To: FreeBSD Mailing List , Matthew Seaman , Gary Kline References: <20040110221036.GA44130@tao.thought.org> <20040110223308.GA4881@happy-idiot-talk.infracaninophile.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040110223308.GA4881@happy-idiot-talk.infracaninophile.co.uk> User-Agent: Mutt/1.4.1i cc: Gary Kline Subject: Re: perl script question. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jan 2004 22:38:25 -0000 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