Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Search file for certain lines

by wjw (Deacon)
on Sep 23, 2013 at 09:51 UTC ( #1055260=note: print w/ replies, xml ) Need Help??


in reply to Search file for certain lines

..so if I read this right, you are not interested in lines that begin with h(lower case). You are only interested in outputting lines that start with j, E, or G. If that is in fact the case, then the problem should be pretty simple. Read the file into an array, loop through the array line by line using a regex to check for lines beginning with j, E or G and print them out.

I get the impression I am missing something here... What importance do the lines beginning with h(lower case) have to you?

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


Comment on Re: Search file for certain lines
Re^2: Search file for certain lines
by Anonymous Monk on Sep 23, 2013 at 09:54 UTC

    Read the file into an array,

    Why?

      ..it generally works for me. I like iterating through an array. The question I face rarely is "why not", which boils down to file size in those rare cases. It is easy to see what I am working with using the debugger when I have an array available with everything in it. I am used to working with arrays.... Mostly this is just personal preference, but it works for me, so I suggest it...
      • ...the majority is always wrong, and always the last to know about it...
      • The Spice must flow...
      • ..by my will, and by will alone.. I set my mind in motion

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-10-02 08:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (52 votes), past polls