试图用awk获得结果 [英] trying to get the results using awk

查看:190
本文介绍了试图用awk获得结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为xyz.csv的文件,它们之间用逗号隔开。我试图得到第二列应该有值01,第50列为ABC和第80列的内容使用nawk的输出?

I've a file named xyz.csv which are comma separated.I'm trying to get the output where the 2nd column should have value "01", 50th column as "ABC" and the content of 80th column using nawk?

推荐答案

您可以请尝试以下方法,并告诉我是否有帮助。

Could you please try following and let me know if this helps.

nawk -F"," '$2=="01" && $50 == "ABC"{print $80}'  xyz.csv

OR

如果你正在寻找第50和第80个字段的值应该是 ABC ,并且你想要打印当前行,那么下面的内容可能会帮助你。

If you are looking for 50th and 80th field's value should be ABC and you want to print current line then following may help you in same.

nawk -F"," '$2=="01" && $50 == "ABC" && $80 == "ABC"'  xyz.csv

这篇关于试图用awk获得结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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