|
|
|
|
|
by acqq
4462 days ago
|
|
Who never wrote it but assumed we know that the same program in Perl, without using command line switches is while (<>) {
print;
}
Still Awk is shorter: { print }
And if you are allowed change the switches of the command line to Perl for your program that Perl program can have exactly 0 bytes. |
|
By default, unless you use the BEGIN block or something, awk will run your program on each line of stdlin. This is useful for programs of the type:
(/some regular expression/) { some action}
The default action if you don't specify one is "print $0" (the whole matching line). If your condition is a plain-ol' expression rather than a regular expression, and it always evaluates truthy, you thus get every line.