在第N个字段中删除编号小于X的行

时间:2016-11-01 22:30:05

标签: linux bash awk sed grep

我有一个由以下行组成的文件:

ExampleText | En | 1.0
ExampledText | Es | 0.9
ExamplesText | En | 0.9994
ExampleTexts | Br | 0.991
ExampledText | Es | 0.83324
ExamplerText | En | 0.4494

使用grep .*| En,我可以获得包含En的所有行。但是,如何删除最后一列中包含小于0.5的所有值?

因此,输出是:

ExampleText | En | 1.0
ExamplesText | En | 0.9994

非常感谢您的积极投入。

1 个答案:

答案 0 :(得分:0)

awk '$2 == "En" && $3 >= .5' FS=' \\| '
  1. 将字段分隔符设置为 |

  2. 匹配,如果字段2等于En且字段3大于或等于.5

相关问题