AWK:如何禁止默认打印 以下 awk if 语句总是打印 $0。如何阻止它这样做
( nodeComplete && count )
{
#print $0
#print count;
for (i = 0; i < count; i++) {print array1[i];};
nodeComplete=0;
count=0;
}
最佳答案
欢迎使用 SO,尝试更改大括号 {
的位置,如果有帮助请告诉我。
( nodeComplete && count ){
#print $0
#print count;
for (i = 0; i < count; i++) {print array1[i];};
nodeComplete=0;
count=0;
}
上述变化的解释:
logic behind this is simple { next to condition means coming statements should be executed as per condition. If you put them in next line then it will all together a different set of block and condition will be a different block. So if condition is TRUE then it will print complete line since { is altogether a separate block.
关于AWK:如何抑制默认打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52090128/