Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Parsing a text file to get the location of the latest

by NetWallah (Abbot)
on Nov 03, 2012 at 04:47 UTC ( #1002074=note: print w/replies, xml ) Need Help??


in reply to Re: Parsing a text file to get the location of the latest
in thread Parsing a text file to get the location of the latest

This one-line does the job (With your current sample data):
perl -000 -ne '($l,$d)=m/Location:\s+(\S+).+BuildDate:\s+(\d.+\d)/s; ( +$lm,$ld)=($l,$d) if $d gt $ld and m/Approved/s}{print qq|$lm\n|' YOUR +-FILE-NAME.txt
Note1 - the Date compare logic is very weak - it simply does a textual compare.
Note2 - "Approved" verification is very weak.
This is a working sample - you can use it to build a more robust program.
Change single-quotes to double, if you use Window$.

Update: Oops - I had intended to respond to the original post - but got OGB's post instead. Sorry.

             "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002074]
help
Chatterbox?
[shmem]: of course
[shmem]: the members of @another_array are conflated to @array
[shmem]: try it out:
[Lady_Aleena]: shmem, thanks. I'm am way out of practice.
[shmem]: perl -lE '@foo = (0..3);@bar = (4..7); push @foo,@bar; say for @foo'
[Lady_Aleena]: shmem, I feel like an idiot for forgetting something so basic.
shmem puts a big cauldron of "silly con charme" on the table in the refectorium
[reisinge]: 'push @foo, @bar' is the same as '@foo = (@foo ,@bar)' ?

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2017-04-27 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (503 votes). Check out past polls.