如何在特定列中grep值小于0.2的行? [英] How to grep rows that have value less than 0.2 in a specific column?

查看:157
本文介绍了如何在特定列中grep值小于0.2的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  ID RT      EZ    Z0      Z1      Z2    RHO     PHE 

 1889  UN    NA  1.0000  0.0000  0.0000  0.8765  -1  
 1890  UN    NA  1.0000  0.0000  0.0000  0.4567  -1  
 1891  UN    NA  1.0000  0.0000  0.0000  0.0012  -1  
 1892  UN    NA  1.0000  0.0000  0.0000  0.1011  -1  

我想grep所有具有小于0.2的列'RHO'的ID,其他列包含在选定的行中。

I would like to grep all the IDs that have column 'RHO' with value less than 0.2, and the other columns are included for the selected rows.

推荐答案

使用 awk 直接说 awk'$ field<值'

$ awk '$7<0.2' file
 1891  UN    NA  1.0000  0.0000  0.0000  0.0012  -1  
 1892  UN    NA  1.0000  0.0000  0.0000  0.1011  -1  

由于 RHO 是列 7 ,它会检查该字段。

As RHO is the column 7, it checks that field.

如果你只是想打印一个特定的列,比如 awk'$ field<值{print $ another_field}'。对于 ID

In case you just want to print a specific column, say awk '$field < value {print $another_field}'. For the ID:

$ awk '$7<0.2 {print $1}' file
1891
1892

这篇关于如何在特定列中grep值小于0.2的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆