We run into one of these "How do I do this in a one-liner?" questions
pretty frequently, and I for one have to ask, what exactly makes the
one-liner so compelling, especially when you are using it for something
that will be run repeatedly?

IMHO it would have been much more practical to just create a three line
Perl script and run it from the command-line.  It makes it easier to
read, doesn't discourage commenting, and avoids the contortions
sometimes needed to cram it all into one line.



-----Original Message-----
From: stu meacham [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 21, 2006 8:25 AM
To: Jay Savage; beginners perl
Subject: Re: regex one liner

I tried one final time with non-capturing parentheses i.e.  (?:  to no
avail.  
This works just fine however:

perl -i -p -e '@matches = m/\d{2}\t\d{2}\t\d{2}/g; s/.*//g;
print"@matches\n"' 

Retrieve, delete what's left, and rewrite what's to be kept.  It should
now
work everytime all the time.  Crude but effective.  My (result)/(time
spent) 
ratio would have been lower without your help. I stumbled over the  ;
inside
  of the ''s for one.
Thanks very much.

<snip>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to