aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/extract.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-05-27 23:14:14 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-05-27 23:14:14 +0300
commita9df82701a087b45b4c6991fb0c20f6911c278ad (patch)
treeddc1ae7cc962003964ac211ac9dd9353fc3691fb /awklib/extract.awk
parent94916f2066cc45507ac9605dfc897f63eb3f0ea0 (diff)
parent29f1563294ac1ab19aa252f3fd5fca94c4f88516 (diff)
downloadegawk-a9df82701a087b45b4c6991fb0c20f6911c278ad.tar.gz
egawk-a9df82701a087b45b4c6991fb0c20f6911c278ad.tar.bz2
egawk-a9df82701a087b45b4c6991fb0c20f6911c278ad.zip
Merge branch 'gawk-4.2-stable'
Diffstat (limited to 'awklib/extract.awk')
-rw-r--r--awklib/extract.awk10
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