$/ = undef or $data = <> and $data =~ s{ ^TABLE;([^;\n]+).*$ | ^COLUMN;(.+?);.*$ }{$1 ? (($t=$1),"") : "$t.$2"}mexg; print $data;