Question

I have file a.pdb as

ATOM      1  N   ARG     1     -19.794 -23.351   -9.550  1.00  0.00           N
ATOM      2  H1  ARG     1     -20.314 -23.948   -8.920  1.00  0.00           H
ATOM      3  H2  ARG     1     -18.811 -23.572   -9.490  1.00  0.00           H
ATOM      4  H3  ARG     1     -20.049 -23.660  -10.480  1.00  0.00           H
ATOM      5  CA  ARG     1     -20.087 -21.926   -9.380  1.00  0.00           C

I want to delete one space between field 7 and 8, without changing the format, but just shifting one character backwards. The Decimal points should appear in column 35, 43 and 51 (now they are on 35, 43 and 52).

Was it helpful?

Solution

sed -r 's/^(.{46}) /\1/' infile > outfile

OTHER TIPS

Same thing with cut:

cut -c 1-46,48- < a.pdb
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top