Hello,
I'm trying to modify a file which has weird column delimiters (a variable number of spaces, depending on the columns).
The file looks like this:
ATOM 148 N GLY B 1 2.150 -1.246 -0.905 1.00 0.00 N
ATOM 149 CA GLY B 1 2.840 -0.380 -1.790 1.00 0.00 C
ATOM 150 C GLY B 1 4.050 -1.070 -2.403 1.00 0.00 C
ATOM 151 O GLY B 1 4.390 -2.201 -2.053 1.00 0.00 O
etc
I need to modify column 2, such that the current value 'n' is replaced by 'n-147', in other words, I want:
ATOM 1 N GLY B 1 2.150 -1.246 -0.905 1.00 0.00 N
ATOM 2 CA GLY B 1 2.840 -0.380 -1.790 1.00 0.00 C
ATOM 3 C GLY B 1 4.050 -1.070 -2.403 1.00 0.00 C
ATOM 4 O GLY B 1 4.390 -2.201 -2.053 1.00 0.00 O
So simple and yet I can't get awk to do it properly without messing everything up. Can anyone help please?
Many thanks!!
T