I think this would be better written as:

    lines = data.lines.select { |line| line =~ /desc|srvr|ptcl/ }.map(&:strip)

And then replace `tmp` with `lines` below