There is no multi-line comment in AWK, but you can fake it if you need to. Here is one method 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/ {
It's nice to have multi-line comments for commenting sections of code during debugging. I would not necessarily use this method for documentation, since it cannot be guaranteed that text without code will not be parsed for syntax errors.
He also works at mawk
.
source share