sed -r 's/^(.{46}) /\1/' infile > outfile
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).
解决方案
其他提示
Same thing with cut:
cut -c 1-46,48- < a.pdb
不隶属于 StackOverflow