Pau*_*ce. 15
AWK中没有多行注释,但如果需要,可以伪造它.这是一种至少在GNU AWK(gawk)中有效的技术:
#!/usr/bin/awk -f
0 {
You can use
0 to cause
a block to
not execute
or be parsed
}
{
print $2, $1, $3
if (0) {
You can use if (0)
in a similar manner
inside a block
}
sum += $4
}
0 && /pattern/ { # prepend "0 &&" to other conditions to turn off a block
print
}
Run Code Online (Sandbox Code Playgroud)
很高兴能够在调试期间使用多行注释来注释掉代码段.我不一定会将此技术用于文档,因为可能无法保证不会因语法错误而解析非代码文本.
它似乎也有效mawk.
| 归档时间: |
|
| 查看次数: |
9692 次 |
| 最近记录: |