Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-12-18 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (43 votes), past polls