$ perl -ne 's{\b(\d+)\b}{$1.}g;print' moves # or just $ perl -pe 's{\b(\d+)\b}{$1.}g' moves