aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/extract.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-05-27 18:43:20 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-05-27 18:43:20 +0300
commit29f1563294ac1ab19aa252f3fd5fca94c4f88516 (patch)
tree1acfaad5610df7af96bd9a2ddce1eb3d8b9304e9 /awklib/extract.awk
parent58cc32a6d4a179b3005f8e4fecbff932da681fba (diff)
downloadegawk-29f1563294ac1ab19aa252f3fd5fca94c4f88516.tar.gz
egawk-29f1563294ac1ab19aa252f3fd5fca94c4f88516.tar.bz2
egawk-29f1563294ac1ab19aa252f3fd5fca94c4f88516.zip
Bug fix to extract.awk. Rerun and update files.
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