From: Cee Joe Date: 2011-04-28T23:06:53+09:00 Subject: Re: File position and buffers Thanks guys for your helpful comments. I will be more descriptive. I am an intern and my mentor wants me to use the IO.pos to read the characters of the file until the character reaches the ">" symbol. SO upon the cursor reaching the ">" symbol(which is the start of a new entry), he wants me to place that previous entry in a buffer. Here is the actual test file I am working with: >gi|329295464|ref|NM_2005745.3Acc1| Def1 zgc:65895 (zgc:65895), mRNA\n AGCTCGGGGGCTCTAGCGATTTAAGGAGCGATGCGATCGAGCTGACCGTCGCG\n \n >gi|456299107|ref|NM_2342343.3Acc2| Def2 zgc:65895 (zgc:65895), mRNA\n GTCGCTGGGTCGAAAAGTGGTGCTATATCGCGGCTCGCGTCGATGTCGCGATG\n CGTGCGCGCGAGAGCGCGCTATGATGAAAGGATGAGAGAG\n \n >gi|3542945647|ref|NM_7453343.5Acc3| Def3 zgc:65895 (zgc:65895), mRNA\n CGTGCGGGGABCCGTACGTGCCGTGGGGGTTTAATAGCGCGCCATCTGAGCAG\n TTAGTCGCTGACGCATGCACG\n \n 7stud, you are right there are two consecutive newlines which I failed to mention. This should be the output of a buffer for one entry: >gi|456299107|ref|NM_2342343.3Acc2| Def2 zgc:65895 (zgc:65895), mRNA\n GTCGCTGGGTCGAAAAGTGGTGCTATATCGCGGCTCGCGTCGATGTCGCGATG <-- no "\n" CGTGCGCGCGAGAGCGCGCTATGATGAAAGGATGAGAGAG <-- no "\n" Notice how the newlines are gone. So with the exception of the header in each entry, the newlines should be gone and be placed in a buffer. I am lost on how to use the IO.pos and a file iterator to make sure each respective entry goes into a buffer without the file being indexed into memory. Thanks in advance, I'm new to the language and trying to wrap my head around it. -- Posted via http://www.ruby-forum.com/.