From: jake kaiden Date: 2011-04-30T05:38:57+09:00 Subject: Re: File position and buffers hi Cee - hmm, i'm getting a bit confused as to what exactly you're trying to do - but if you want to load all this stuff into a buffer without the newlines, and regardless of how many newlines you have between each entry (assuming that an "entry" is something that starts with ">") - i don't see why this wouldn't work: f = "0text.txt" file = File.open(f) buffer = [] bufferindex = 0 file.each(sep = ">"){|line| buffer[bufferindex] = line bufferindex += 1 } ## here you would do something more interesting buffer.collect{|line| line = line.delete("\n") p ">#{line}" } which will return... ">>" ">gi|329295464|ref|NM_2005745.3Acc1| Def1 zgc:65895 (zgc:65895), mRNAAGCTCGGGGGCTCTAGCGATTTAAGGAGCGATGCGATCGAGCTGACCGTCGCG>" ">gi|456299107|ref|NM_2342343.3Acc2| Def2 zgc:65895 (zgc:65895), mRNAGTCGCTGGGTCGAAAAGTGGTGCTATATCGCGGCTCGCGTCGATGTCGCGATGCGTGCGCGCGAGAGCGCGCTATGATGAAAGGATGAGAGAG>" ">gi|3542945647|ref|NM_7453343.5Acc3| Def3 zgc:65895 (zgc:65895), mRNACGTGCGGGGABCCGTACGTGCCGTGGGGGTTTAATAGCGCGCCATCTGAGCAGTTAGTCGCTGACGCATGCACG" ...whether you have 0 or 100,000 newlines between each entry. is this not what you're looking for? -j -- Posted via http://www.ruby-forum.com/.