diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-05-27 23:14:49 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-05-27 23:14:49 +0300 |
commit | 25b0b016e33315857b299fbacf7c17e3d35a9e4f (patch) | |
tree | 0ca540185be200904a21a116a8de2afd14cec64b /awklib/extract.awk | |
parent | e4c4d7bdb58cc90d8397a5d7d72d03974ad6a5fb (diff) | |
parent | a9df82701a087b45b4c6991fb0c20f6911c278ad (diff) | |
download | egawk-25b0b016e33315857b299fbacf7c17e3d35a9e4f.tar.gz egawk-25b0b016e33315857b299fbacf7c17e3d35a9e4f.tar.bz2 egawk-25b0b016e33315857b299fbacf7c17e3d35a9e4f.zip |
Merge branch 'master' into feature/fix-comments
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 |