Hello All,
I would like to read a file in ruby. It is a 2G file, but
contain useless data in the beginning portion of the file.
There is a particular pattern towards the middle of the file after
which useful data begins. Is there a way to grep for this pattern and
then read every line henceforth, but ignore all lines previous to line
on which pattern found?
Thanks,
Vandana
There is a particular pattern towards the middle of the file after
which useful data begins. Is there a way to grep for this pattern and
then read every line henceforth, but ignore all lines previous to line
on which pattern found?
If you don’t know where it is, then you’ll probably have to parse each
line until you reach it, then continue on.
-rp
On Wed, May 12, 2010 at 1:20 PM, Vandana [email protected] wrote:
Hello All,
I would like to read a file in ruby. It is a 2G file, but
contain useless data in the beginning portion of the file.
There is a particular pattern towards the middle of the file after
which useful data begins. Is there a way to grep for this pattern and
then read every line henceforth, but ignore all lines previous to line
on which pattern found?
Grep is going to have to read the file to find that pattern anyway.
–
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale