gpt4 book ai didi

AWK:如何抑制默认打印

转载 作者:行者123 更新时间:2023-12-05 06:30:45 24 4
gpt4 key购买 nike

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com