4 ms·
"The AWK programming language" has already been suggested and is great. But awk is actually pretty simple. Imagine everything having an implicit loop like this
by patrec 8y ago
"The AWK programming language" has already been suggested and is great.
But awk is actually pretty simple. Imagine everything having an implicit loop like this around it like so:
# BEGIN{ ... } would go here
for $0 in input.split('\n'):
$1, $2, ... = line.split()
# if TEST {ACTION}; pairs ...
# END { ... } would go here
so the first TEST in GP's awk would be `$1 ~ /class|module/` and the corresponding ACTION to take `{print $2}`.
if TEST is omitted it's True, if ACTION is it's print the whole line.