我有一个文件a.pdb为
ATOM 3201 CD2 LEU A 337 7.734 18.538 6.979 0.00 0.00 0.000 C
ATOM 3202 C LEU A 337 5.169 14.358 7.663 0.00 0.00 0.206 C
ATOM 3203 O LEU A 337 4.123 14.537 8.395 0.00 0.00 -0.646 OA
ATOM 3204 OXT LEU A 337 5.124 13.563 6.672 0.00 0.00 -0.646 OA
HETATM 3206 CA CA A 338 18.241 31.994 15.308 0.00 0.00 0.000 CA
HETATM 3207 CA CA A 339 16.703 30.240 22.272 0.00 0.00 0.000 CA
期望的输出:
ATOM 3201 CD2 LEU 337 7.735 18.538 6.979 0.00 0.00 0.000 C
ATOM 3202 C LEU 337 5.169 14.358 7.663 0.00 0.00 0.206 C
ATOM 3203 O LEU 337 4.122 14.537 8.395 0.00 0.00 -0.646 OA
ATOM 3204 OXT LEU 337 5.124 13.562 6.671 0.00 0.00 -0.646 OA
HETATM 3206 CA CA 338 18.242 31.994 15.307 0.00 0.00 0.000 CA
HETATM 3207 CA CA 339 16.703 30.240 22.272 0.00 0.00 0.000 CA
如何更换字母" A"在第22列或第5块有空格但保留a.pdb的格式?
答案 0 :(得分:1)
使用awk
:
awk '$0=substr($0,1,21) FS substr($0,23)' file
$ awk '$0=substr($0,1,21) FS substr($0,23)' file
ATOM 3201 CD2 LEU 337 7.734 18.538 6.979 0.00 0.00 0.000 C
ATOM 3202 C LEU 337 5.169 14.358 7.663 0.00 0.00 0.206 C
ATOM 3203 O LEU 337 4.123 14.537 8.395 0.00 0.00 -0.646 OA
ATOM 3204 OXT LEU 337 5.124 13.563 6.672 0.00 0.00 -0.646 OA
HETATM 3206 CA CA 338 18.241 31.994 15.308 0.00 0.00 0.000 CA
HETATM 3207 CA CA 339 16.703 30.240 22.272 0.00 0.00 0.000 CA
答案 1 :(得分:0)
您可以gsub
使用awk
来执行此操作...
awk '{gsub("A"," ",$5); print}' a.pdb