我正在寻找获得特别是“猫”的线路号码的方法。
我在ubuntu 16.04上尝试了这样的命令
cat flux.log |grep "statistic"这就是发现信息的结果。
Using fit statistic: chi
Using test statistic: chi
Fit statistic : Chi-Squared = 175.92 using 16 PHA bins.
Test statistic : Chi-Squared = 175.92 using 16 PHA bins.
Fit statistic : Chi-Squared = 175.92 using 16 PHA bins.
Test statistic : Chi-Squared = 175.92 using 16 PHA bins.
Fit statistic in use: Chi-Squared
Using fit statistic: chi
Using test statistic: chi
Fit statistic : Chi-Squared = 175.92 using 16 PHA bins.
Test statistic : Chi-Squared = 175.92 using 16 PHA bins.
Fit statistic : Chi-Squared = 6.05 using 16 PHA bins.
Test statistic : Chi-Squared = 6.05 using 16 PHA bins.
Fit statistic : Chi-Squared = 6.05 using 16 PHA bins.
Test statistic : Chi-Squared = 6.05 using 16 PHA bins.
Fit statistic : Chi-Squared = 6.05 using 16 PHA bins.
Test statistic : Chi-Squared = 6.05 using 16 PHA bins.
Fit statistic : Chi-Squared = 6.05 using 16 PHA bins.
Test statistic : Chi-Squared = 6.05 using 16 PHA bins.
Fit statistic : Chi-Squared = 6.05 using 16 PHA bins.
Test statistic : Chi-Squared = 6.05 using 16 PHA bins.
Fit statistic : Chi-Squared = 66.15 using 16 PHA bins.
Test statistic : Chi-Squared = 66.15 using 16 PHA bins.
Fit statistic in use: Chi-Squared
Using fit statistic: chi
Using test statistic: chi
Fit statistic : Chi-Squared = 66.15 using 16 PHA bins.
Test statistic : Chi-Squared = 66.15 using 16 PHA bins.在这个结果中,我想用最后一行来捕捉信息。
Fit statistic : Chi-Squared = 66.15 using 16 PHA bins.
Test statistic : Chi-Squared = 66.15 using 16 PHA bins.问题是有很多行,而这些数字是随机的。所以我只有“适合”、“测试”、“统计”或“X-平方”这样的信息来查找。
如果这些结果有行号,并且可以被区分,我可以找到我想要的行。有人帮我吗?
ps,我试过这个命令
<cat -n flux.log |grep "statistic">但是每个文件的所有行都是不同的。
发布于 2018-01-25 06:55:54
试试man nl。也是awk '{print NR,$0}' myfile
https://stackoverflow.com/questions/48436615
复制相似问题