- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
<分区>
我需要找到一种方法来汇总文件中特定列的所有整数值,并打印其结果。这是我的文件的一部分:
<<< The program found 0 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 0 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 1 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 0 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 0 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 2 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 0 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 0 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 2 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 0 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
<<< The program found 1 rare variants for the gene ARIH1 for this HEALTHY_CONTROL <<<
我想打印第 5 列的总和,即稀有变体的总数。在这个例子中,它应该打印 6。
我尝试了以下命令(没有用):
grep "rare variants for the gene ARIH1" fileName | tail -n+2 | awk -F " " '{sum+=$5} END {print sum}'
此命令打印 1,这是错误的。
我该怎么办?谢谢!
我是一名优秀的程序员,十分优秀!