From: Panu Kinnari Date: 2008-10-03T01:07:21+09:00 Subject: Re: Parsing non-delimited text file > I'm not sure how big the actual data is, but if it's very large you > may want to consider not using readlines(). It is large, example I provided is excerpt from 450 page, 2 mb text file. You "slurp" all of this > data into memory, but then walk through it one line at a time. > Instead, you could just read it a line at a time, using foreach() > instead of readlines(). I will look into this. > To check if a String begins with a number you can use: > > if str =~ /\A\d/ > # handle string that starts with a number here > end > Thanks, I'll try this > Hope that helps. It sure does. I was wondering, would it be feasible to construct regexp for each line type? They do follow certain convention to certain extent after all. Atleast lines that matter. Thanks again. -- Posted via http://www.ruby-forum.com/.