Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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: date: 2004/2/1 unwanted info: blah blah blah name: date: 2004/3/12 unwanted info: blah blah blah __END__ 1. 2004/2/1 2. 2004/3/12

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://240807]
[jdporter]: I for one think it's kind of ridiculous that people can't ask - here - other people for help just because it involves monetary compensation.
[jdporter]: I think the test for whether to push it to should be strict: (a) you're looking for employment, or (b) you're looking to hire an employee or contractor.

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2017-03-23 01:11 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (278 votes). Check out past polls.