I have a manifest file that contains a build_version=XX number field (among a lot of others) that I want to automatically increment. Here is a simple Perl one-liner to increment that number in a given file.
perl -pi -e 's/(build_version)=(\d+)/"build_version=" . ($2 + 1)/e' manifest
In this example the
/e in the regexp says that the replace value is an expression. In this case the replace value is some math that add adds one to the current value.