Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: Search file for certain lines

by wjw (Curate)
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2016-10-21 21:05 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.