diff options
Diffstat (limited to 'awklib/extract.awk')
-rw-r--r-- | awklib/extract.awk | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/awklib/extract.awk b/awklib/extract.awk index 2662574b..96fc9498 100644 --- a/awklib/extract.awk +++ b/awklib/extract.awk @@ -30,7 +30,7 @@ BEGIN { IGNORECASE = 1 } } if ($3 != curfile) { if (curfile != "") - close(curfile) + filelist[curfile]++ # save to close later curfile = $3 } @@ -60,6 +60,10 @@ BEGIN { IGNORECASE = 1 } print join(a, 1, n, SUBSEP) > curfile } } +END { + for (f in filelist) + close(filelist[f]) +} function unexpected_eof() { printf("extract: %s:%d: unexpected EOF or error\n", @@ -67,10 +71,6 @@ function unexpected_eof() exit 1 } -END { - if (curfile) - close(curfile) -} # join.awk --- join an array into a string # # Arnold Robbins, arnold@gnu.org, Public Domain |