perl -e'$_="~|TOTAL 24.1% 0.4%"; /\|TOTAL\s+([0-9.]+)%\s+([0-9.]+)/ && print "Matched, $1 $2\n"' Matched, 24.1 0.4