We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent faf7efe commit 1da7341Copy full SHA for 1da7341
scripts/jq-template.awk
@@ -17,6 +17,18 @@ function jq_escape(str, # parameters
17
return out
18
}
19
20
+# return the number of times needle appears in haystack
21
+function num(haystack, needle, # parameters
22
+ ret, i ) # locals
23
+{
24
+ ret = 0
25
+ while (i = index(haystack, needle)) {
26
+ ret++
27
+ haystack = substr(haystack, i + length(needle))
28
+ }
29
+ return ret
30
+}
31
+
32
BEGIN {
33
jq_expr_defs = ""
34
jq_expr = ""
@@ -76,7 +88,7 @@ function append_jq(expr) {
76
88
agg_jq = agg_jq line
77
89
line = ""
78
90
79
- if (!index(agg_jq, CLOSE)) {
91
+ if (num(agg_jq, OPEN) > num(agg_jq, CLOSE)) {
80
92
next
81
93
82
94
0 commit comments