> > count = 0 > ARGF.each do |line| ## treating a line at turn > puts line unless count.zero? > count = [0, count-1].max > if line =~ /your keyword or something/ then > puts line > count = 8 > end > end > Ok, I started with this one, but run into one problem - again probably simple... The way this is written it asks for a regexp as a keyword. Now, I do have a text file, in which I have a number of key words, one in each line. What I wasnt able to figure out thus far was how to change the above code so that it would expect a variable instead of a regexp. When I defined a variable within the code var1 = 'KOG0019' and tried to use it as an argument ala if = var1 then it did something..., but instead of finding the corresponding line and copying the following at lines it copies like 12000 lines and puts the keyword in every second line... /Marc -- Posted via http://www.ruby-forum.com/.