3 ms·
My mental image of awk has always been something along these lines: for line in readfile() for block in script: if block.match(line)
by Beltalowda 5y ago
My mental image of awk has always been something along these lines:
for line in readfile()
for block in script:
if block.match(line)
run_block(block)
end
endfor
endfor
Where the "for line in readfile()" is the "implicit loop", and the blocks are
the "condition { .. }" blocks.
The actual flow is a little bit more complex and has some exceptions e.g. (BEGIN/END), but this is about the gist of it.
- dotancohen 5y agoThanks. Yes, I agree that my mental image is pretty much the same but it's nice to see it expressed in Python modulo end keywords ))