From: Marc Hoeppner Date: 2007-07-11T17:35:50+09:00 Subject: if / else, how to include next line Hi everyone, absolute beginner here, so bare with me ;) The following issue came up and I can't figure out how to solve. Probably nothing very complicated, tho. I want to load a text file via ARGV[0] and then search it for a key word. If this key word is found, it should be printed (puts) and...and this is very I am stuck ...it should also included the next 8 lines. The file structure looks like this: KOG0003 Sc 000000000 Dr 000000000 Ar 001010011 Ca 000100100 Ho 001010010 Sa 010000000 An 100000100 Pl 000001000 KOG0009 Sc 000100 Dr 100000 Ar 001001 Ca 101000 Ho 101010 Sa 010000 An 100000 Pl 001000 So lets say I want to select for a specific KOG (or a list of KOGs) and write them together with the associated lines into a new file. I guess the issue at the moment is, that when I open the ARGV[0], it reads one line at a time - cant quite figure out how to include the "go to next line and puts it, too" part. Any help pointing me in the right direction would be greatly appreciated /Marc -- Posted via http://www.ruby-forum.com/.