Delete space in a specific column using sed or cut

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).

Answers


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

Same thing with cut:

cut -c 1-46,48- < a.pdb

Need Your Help

Notification on specific day on android

android push-notification alarmmanager

I am looking to codes that I could make a notification through a day and time I don't know , so the user will determine the day and I have to send notification whenever this day comes , also if the...

In android is there any way to preserve SharedPreferences after an uninstall

android android-preferences android-backup-service

I am keeping some application meta data in SharedPreferences. Whenever I uninstall the application and reinstall it, the SharedPreferences are deleted.