13
There is no multiline comment in AWK, but you can fake it if you need to. Here is one technique that works at least in 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
}
It's nice to be able to have multiline comments for commenting out sections of code during debugging. I wouldn't necessarily use this technique for documentation since it may not be guaranteed that the non-code text would not be parsed for syntax errors.
It seems to also work in mawk.