awk OR陈述式 [英] awk OR statement
本文介绍了awk OR陈述式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给定以下代码片段,awk是否具有OR
语句即:
Does awk have an OR
statement i.e given the following snippet:
awk '{if ($2=="abc") print "blah"}'
是否可以添加OR
语句,以便在$2==abc OR def -> print
时使用?
Is it possible to add an OR
statement so that if $2==abc OR def -> print
?
推荐答案
是.您可以使用逻辑或||
:
Yes. There's logical OR ||
that you can use:
awk '{if ($2=="abc" || $2=="def") print "blah" }'
这篇关于awk OR陈述式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文