I am trying to increment the numbers in a column of a file by a constant value using:
:s/\d\+/\=submatch(0)+8192
where 8192 is the constant I want to add.
My file has the below structure:
ATOM 32760 MW4 wate 8190 6.520 15.778 26.020 0.00 0.00 Mw4
ATOM 32761 OW1 wate 8191 6.550 20.128 25.950 0.00 0.00 O
ATOM 32762 HW2 wate 8191 6.660 21.078 25.990 0.00 0.00 H
ATOM 32763 HW3 wate 8191 7.440 19.778 25.870 0.00 0.00 H
ATOM 32764 MW4 wate 8191 6.680 20.208 25.950 0.00 0.00 Mw4
ATOM 32765 OW1 wate 8192 1.280 16.158 26.060 0.00 0.00 O
ATOM 32766 HW2 wate 8192 1.350 17.108 26.160 0.00 0.00 H
ATOM 32767 HW3 wate 8192 1.800 15.958 25.280 0.00 0.00 H
ATOM 32768 MW4 wate 8192 1.360 16.258 25.970 0.00 0.00 Mw4
ATOM 32769 OW1 wate 1 17.610 8.049 75.290 0.00 0.00 O
ATOM 32770 HW2 wate 1 17.860 7.549 76.060 0.00 0.00 H
ATOM 32771 HW3 wate 1 16.680 8.249 75.420 0.00 0.00 H
ATOM 32772 MW4 wate 1 17.520 8.009 75.410 0.00 0.00 Mw4
ATOM 32773 OW1 wate 2 16.200 7.639 85.230 0.00 0.00 O
ATOM 32774 HW2 wate 2 15.720 8.139 85.890 0.00 0.00 H
ATOM 32775 HW3 wate 2 17.060 8.049 85.200 0.00 0.00 H
ATOM 32776 MW4 wate 2 16.250 7.759 85.320 0.00 0.00 Mw4
ATOM 32777 OW1 wate 3 5.190 10.149 77.870 0.00 0.00 O
ATOM 32778 HW2 wate 3 6.070 10.009 77.530 0.00 0.00 H
ATOM 32779 HW3 wate 3 5.020 11.079 77.730 0.00 0.00 H
At present, my command selects the first integer column which is next to ATOM column and I am visually selecting the values from 1 to end of the file (which is 5th column). Meaning, not able to select the (5th column) by matching patterns since my above command selects only the second column (after ATOM).
However, what I want to do is increment the values starting from 1 to the end of the column with 8192, essentially continuing the numbering from 8192. Could someone suggest what I need to do to achieve this?
8192<C-a>?