-------------------------------1142497609
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
------------------------------------------------------------------------------
---------------
datafile est_kft.txt" # insert correct name here
text .readlines(datafile) # read lines into Array
output_file y_nicely_arranged_text_file.txt" # insert correct name here
class String
def do_first_script
# insert tags here
return result
end
def do_second_script
#insert tags here
return result
end
end
fðìe.new(output_file,"w")
# first alternative
# assuming that you'll always have the same one/two-column
# structure
text.each_with_index{|x,i|
if i<5
f.puts x.do_first_script
else
f.puts x.do_second_script
end
}
# second alternative (recommended)
# use regexps -
# assuming that you separate columns by tabs - and use tabs
# for nothing else than separating columns
text.each{|x|
if x \t/
f.puts x.do_first_script
else
f.puts x.do_second_script
end
}
f.close
-----------------------------------------------
Best regards,
Axel
-------------------------------1142497609--