Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
good chemistry is complicated,
and a little bit messy -LW
 
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



Comment on Re: Simple perl one-liner for transforming text files
Download Code

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 browsing the Monastery: (15)
As of 2014-04-18 19:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (471 votes), past polls