If I understand you correctly, you want to read the second and third 
entry of the first line beginning with 'STS'. You can do this by using 
capture groups in the regular expression (like Robert and Eric already 
did in the posts above).

For example:

File.foreach 'F:/testing.txt' |line|
  if line =~ /\ASTS\+(\w+)\+(\w+)/
    puts $1, $2
    break
  end
end

When the regular expression is applied, the matched content of the 
parenthesized subexpressions are saved in the variables $1 und $2. You 
can then output these variables.

However, you should write a general method like Robert suggested. Then 
you won't have to think about new code every time you want to read a 
certain line but simply use the method.

-- 
Posted via http://www.ruby-forum.com/.