Back to the file size question

I have to make multiple passes through a 50,000 line text file. Should I
just pull it into an array or something?

Pass 1 takes a string
  if the line has that string in it and begins with a substring, put
different substring into Array X.
  if the line has a different but similar string, put another substring
into Array X.
  if the line as another string, put a sub string into Array Y.

Pass 2 iterates through Array X
  if the line as an element from Array X, put a sub string into Array Y

This is based on Array Y being populated by the string itself and by a
different string. I can't say for sure all items in Array X will be parsed
before Array Y.

Thoughts?

Leam

···

--
Mind on a Mission <http://leamhall.blogspot.com/>

​If you are going to preload into ruby, then i would suggest use some
better data structure instead of Array. You can try hash and make the data
more meaningful, modify your code a bit to use the hash and thus improve
the speed of your program.​

···

On Fri, Apr 24, 2015 at 2:39 AM, leam hall <leamhall@gmail.com> wrote:

I have to make multiple passes through a 50,000 line text file. Should I
just pull it into an array or something?

Pass 1 takes a string
  if the line has that string in it and begins with a substring, put
different substring into Array X.
  if the line has a different but similar string, put another substring
into Array X.
  if the line as another string, put a sub string into Array Y.

Pass 2 iterates through Array X
  if the line as an element from Array X, put a sub string into Array Y

This is based on Array Y being populated by the string itself and by a
different string. I can't say for sure all items in Array X will be parsed
before Array Y.

Thoughts?

Leam

--
Mind on a Mission <http://leamhall.blogspot.com/&gt;

--
Harisankar P S
https://twitter.com/coderhs | *http://csnipp.com/coderhs
<http://csnipp.com/coderhs&gt;\*