perl -p -i.bak -e 's/$1/$a/ if ((/xyz\s*=\s*([0-9]*)\s*/)&&($a=$1+1))' test.data