Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 meditating upon the Monastery: (7)
As of 2015-07-04 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls