使用粘贴命令时如何删除输出文件中的尾随空格?

使用粘贴命令时如何删除输出文件中的尾随空格?

提交

ATOM   1149  N   MET B
ATOM   1150  CA  MET B
ATOM   1151  C   MET B
ATOM   1152  O   MET B
ATOM   1153  CB  MET B
ATOM   1154  CG  MET B
ATOM   1155  SD  MET B
ATOM   1156  CE  MET B
ATOM   1157  N   SER B
ATOM   1158  CA  SER B

文件b

   1
   1
   1
   1
   1
   1
   1
   1
   2
   2

文件c

    -16.392 -20.171 -30.339  1.00140.13           N
    -15.456 -21.035 -31.092  1.00140.13           C
    -14.468 -20.202 -31.838  1.00140.13           C
    -13.272 -20.492 -31.837  1.00140.13           O
    -16.220 -21.911 -32.099  1.00140.13           C
    -16.929 -21.120 -33.199  1.00140.13           C
    -18.383 -20.178 -32.645  1.00140.13           S
    -19.479 -21.621 -32.504  1.00140.13           C
    -14.951 -19.121 -32.478  1.00 86.33           N
    -14.079 -18.275 -33.229  1.00 86.33           C

我必须使用粘贴命令将上述文件按照以下格式放在一起,并在列之间留出相同的空格。

我尝试过这个:

paste a b c >bchain.pdb

我的输出

ATOM   1149  N   MET B     1         -16.392 -20.171 -30.339  1.00140.13           N
ATOM   1150  CA  MET B     1         -15.456 -21.035 -31.092  1.00140.13           C
ATOM   1151  C   MET B     1         -14.468 -20.202 -31.838  1.00140.13           C
ATOM   1152  O   MET B     1         -13.272 -20.492 -31.837  1.00140.13           O
ATOM   1153  CB  MET B     1         -16.220 -21.911 -32.099  1.00140.13           C
ATOM   1154  CG  MET B     1         -16.929 -21.120 -33.199  1.00140.13           C
ATOM   1155  SD  MET B     1         -18.383 -20.178 -32.645  1.00140.13           S
ATOM   1156  CE  MET B     1         -19.479 -21.621 -32.504  1.00140.13           C
ATOM   1157  N   SER B     2         -14.951 -19.121 -32.478  1.00 86.33           N
ATOM   1158  CA  SER B     2         -14.079 -18.275 -33.229  1.00 86.33           C

预期输出

ATOM   1149  N   MET B   1     -16.392 -20.171 -30.339  1.00140.13           N
..........
ATOM   1209  N   ARG B  10       3.940  -0.720 -30.221  1.00 88.10           N
...........
ATOM   1882  N   SER B 100      -4.110 -12.604 -45.170  1.00 88.85           N

答案1

paste如果您的文件已经有您需要的间距,只需告诉不要添加任何分隔符

$ paste -d '' a b c
ATOM   1149  N   MET B   1    -16.392 -20.171 -30.339  1.00140.13           N
ATOM   1150  CA  MET B   1    -15.456 -21.035 -31.092  1.00140.13           C
ATOM   1151  C   MET B   1    -14.468 -20.202 -31.838  1.00140.13           C
ATOM   1152  O   MET B   1    -13.272 -20.492 -31.837  1.00140.13           O
ATOM   1153  CB  MET B   1    -16.220 -21.911 -32.099  1.00140.13           C
ATOM   1154  CG  MET B   1    -16.929 -21.120 -33.199  1.00140.13           C

相关内容