BEGIN
A
BEGIN
rule is executed, once, before the first input record has been readPS:
If an
awk
program only has a BEGIN
rule, and no other rules, then the program exits after the BEGIN
rule has been run. (Older versions of awk
used to keep reading and ignoring input until end of file was seen.)END
An
END
rule is executed, once, after all the input has been readBEGIN
and END
rules must have actions; there is no default action for these rules since there is no current record when they run.Reference
[1] awk的BEGIN與END區塊, http://lalakiwe.myweb.hinet.net/Documents/awk/awk_appendix.html
[2] http://www.staff.science.uu.nl/~oostr102/docs/nawk/nawk_52.html
沒有留言:
張貼留言