From owner-freebsd-questions@FreeBSD.ORG Sun Jan 11 21:22:18 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 B90B916A4CE for ; Sun, 11 Jan 2004 21:22:18 -0800 (PST) Received: from sage.thought.org (dsl231-043-140.sea1.dsl.speakeasy.net [216.231.43.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id EB78F43D1D for ; Sun, 11 Jan 2004 21:22:16 -0800 (PST) (envelope-from kline@thought.org) Received: from thought.org (root@tao [10.0.0.247]) by sage.thought.org (8.12.9/8.11.4) with ESMTP id i0C5O3GH051842; Sun, 11 Jan 2004 21:24:05 -0800 (PST) (envelope-from kline@thought.org) Received: (from kline@localhost) by thought.org (8.12.6/8.11.3) id i0C5MCe9076250; Sun, 11 Jan 2004 21:22:12 -0800 (PST) (envelope-from kline) Date: Sun, 11 Jan 2004 21:22:12 -0800 From: Gary Kline To: Matthew Seaman , Gary Kline , FreeBSD Mailing List Message-ID: <20040112052212.GA70559@tao.thought.org> 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> <20040111013434.GC44177@tao.thought.org> <20040111115237.GA10388@happy-idiot-talk.infracaninophile.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040111115237.GA10388@happy-idiot-talk.infracaninophile.co.uk> X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: Observing 17 years of service to the Unix community User-Agent: Mutt/1.5.5.1i 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: Mon, 12 Jan 2004 05:22:18 -0000 On Sun, Jan 11, 2004 at 11:52:37AM +0000, Matthew Seaman wrote: > On Sat, Jan 10, 2004 at 05:34:34PM -0800, Gary Kline wrote: > > On Sat, Jan 10, 2004 at 11:02:18PM +0000, Matthew Seaman wrote: > > > > perl -pi.bak -e 's/\s*\w+_\w+\.?//g;' filename > > > The lines do indeed wrap so this does the job on a test file. > > I do have the re-exp book but this one is far ovr my head. > > What do the "\s*" mean, and also thr "\.?/" ? > Thanks for your tutorial. Time to re-read Jeff Friedl's book. I'd forgotten some of perl's regex rules--specifically, 's' and 'w'; was headsratching what symbolized whitespace. Also did not realize the "\w+_" would match one-or-more underscores. To me, this is the genius of the expression. I have a 994 perl script called reflow that does an outstanding job of formatting std ASCII|8859-N text. I filter any essay thru a program, joinlines, and reflow before handing it off to OpenOffice. What reflow doesn't do is to put two spaces between sentences. That's on my to-hack list:) have a good one, gary -- Gary Kline kline@thought.org www.thought.org Public service Unix