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

Re^2: Search file for certain lines

by wjw (Priest)
on Sep 23, 2013 at 11:00 UTC ( #1055267=note: print w/replies, xml ) Need Help??

in reply to Re: Search file for certain lines
in thread Search file for certain lines

ahhh... So there are not h-starts and h-stops. h(lower case) simply indicates the beginning of a record. My approach would be to find h line and use is as the key in a hash, then iterate until finding each of the subsequent j,E,G lines and adding them as an array under the key(HoA). When you find another h-line, you make a new key and wash,rinse,repeat until end of data. You end up with a structure which is pretty easy to continue to manipulate and do further clean up on if you want to.

I am sure there are a bunch of other ways to do this, many better. But what I like about this approach is that it uses well documented data structures which are simple to manipulate. Good luck! Should be fun... :-)

  • ...the majority is always wrong, and always the last to know about it...
  • The Spice must flow...
  • my will, and by will alone.. I set my mind in motion

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1055267]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2018-05-28 10:24 GMT
Find Nodes?
    Voting Booth?