Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Simple perl one-liner for transforming text files

by OM_Zen (Scribe)
on Mar 06, 2003 at 04:48 UTC ( #240807=note: print w/ replies, xml ) Need Help??


in reply to Simple perl one-liner for transforming text files

Hi , The regular expression pre-defined variables can be the ones to be for this
while(<Fnm>){chomp;if($_=~/^name:\s+/){$cnt++;print "$cnt\. $'";}elsif +($_=~/^date:\s+/){print " $'\n";}} __DATA__ name: url1.domain1.com date: 2004/2/1 unwanted info: blah blah blah name: url2.domain5.org date: 2004/3/12 unwanted info: blah blah blah __END__ 1. url1.domain1.com 2004/2/1 2. url2.domain5.org 2004/3/12


Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://240807]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2016-06-29 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (387 votes). Check out past polls.