trying to get the results using awk

血红的双手。 提交于 2019-12-12 06:47:44

问题


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?


回答1:


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

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

OR

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


来源:https://stackoverflow.com/questions/47113325/trying-to-get-the-results-using-awk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!