Unix/Linux: perl -i.bak -pe 's/(newyork\s+)1536000/${1}7878787878/' test.cfg Windows: perl -i.bak -pe "s/(newyork\s+)1536000/${1}7878787878/" test.cfg