perl script question.

Gary Kline kline at thought.org
Sun Jan 11 21:22:18 PST 2004


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 at thought.org   www.thought.org     Public service Unix



More information about the freebsd-questions mailing list