emacs - replace numbers with calculated numbersPosted by rolf on Saturday, 17 January 2015
To replace numbers in a document with other calculated numbers (e.g. to replace a 20 with 20-10=10, and a 43 with 33), the best is to use
which is bound to
M-C-% (= M-C-Shift-5).
E.g. to subtract 8 from each number in the string
do the following:
[Query replace regexp:] \([0-9][0-9]\) RET [Query replace regexp in region \([0-9][0-9\) with:] \,(+ -8 \#1) RET
RET = press the return key.