Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: File Parsing

by shortyfw06 (Beadle)
on May 31, 2012 at 20:45 UTC ( #973606=note: print w/ replies, xml ) Need Help??


in reply to Re: File Parsing
in thread File Parsing

Thank you for the replies. To complicate this a bit more, if the file looks like this and I need to parse out the last two occurances of the search string, skip three lines in each and then only print the lines of data that have 0.150 in the first field and -45.00 in the third field, what would I add? Thanks Again!

9 FAILURE CRITERIA PER PLY FAILURE CRITERIA PER PLY DIST ANGLE PLY FAILURE NUMBERS 1 2 SHEAR 0.000 0.00 -45.00 0.238 0.282 -1.459 0.000 0.00 0.00 0.971 1.369 0.004 0.150 5.00 -45.00 0.475 0.142 -1.585 0.150 5.00 0.00 1.003 1.531 -0.274 FAILURE CRITERIA PER PLY DIST ANGLE PLY FAILURE NUMBERS 1 2 SHEAR 0.000 0.00 -45.00 0.247 0.293 -1.514 0.000 0.00 0.00 1.008 1.422 0.004 0.150 5.00 -45.00 0.493 0.147 -1.645 0.150 5.00 0.00 1.042 1.589 -0.284


Comment on Re^2: File Parsing
Download Code
Re^3: File Parsing
by thundergnat (Deacon) on Jun 01, 2012 at 14:30 UTC
    if the file looks like this and I need to parse out the last two occurances of the search string, skip three lines in each and then only print the lines of data that have 0.150 in the first field and -45.00 in the third field, what would I add?

    <smartass>"Code to do that" seems like an obvious answer.</smartass>

    Honestly though, there is code in my example above that demonstrates splitting into fields and checking for equality isn't a very obscure operation. Try it yourself and if you can't figure it out, show us your code that doesn't work. You'll get less sarcastic answers if you demonstrate that you've made a little effort.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973606]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-07-30 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (237 votes), past polls