print "Input file name: "; $_ = <>; chop; open(INFILE, $_); while () { if(m/total/) { s/^total\s[0-9]+\s[0-9]+\s([0-9]+)\s([0-9]+)$/$1 $2/; print; } } close INFILE