从大文本复制值(数字)

时间:2013-03-26 02:26:21

标签: linux

我有一个庞大的文件,想要以列格式将一组数字复制到另一个文本文件,以便我可以绘制数据。

  • 文字

    CC for particle      1 is  0.05378168  phase residual is  78.77
    
    values of PSI,THETA,PHI at FMATCH extraction   88.780   62.638  352.976
    Time before particle       2 was  19:31:43
    
    CC for particle      2 is  0.05370924  phase residual is  79.34
    
    values of PSI,THETA,PHI at FMATCH extraction   88.399  123.675  354.108
    
    CC for particle      3 is  0.04939323  phase residual is  78.30
    
    values of PSI,THETA,PHI at FMATCH extraction   87.646   98.585  353.899
    
    CC for particle      4 is  0.05664483  phase residual is  79.33
    
    values of PSI,THETA,PHI at FMATCH extraction   87.755  116.152  350.454
    
    CC for particle      5 is  0.06687291  phase residual is  78.83
    

我想在粗体中提取行尾的相位残差值。 我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:2)

根据您的示例,我假设您在所需的数字之前总是is

sed -n 's/.*is *\([0-9]*\.[0-9]*\)$/\1/p' input

这应该得到你想要的粗体数字,但如果你想要,你可以更严格:

sed -n 's/.*phase residual is *\([0-9]*\.[0-9]*\)$/\1/p' input