summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2025-07-14 18:34:38 +0200
committerMarc Vertes <mvertes@free.fr>2025-07-14 18:34:38 +0200
commit22a7e5d77587372ea4c63c84fd8e0447f424bc15 (patch)
tree7e75701566276e01a09a4a1ad472427d6dba1969
parent67dd4112a7b7b7851b8a16d4715354a3a79a02a9 (diff)
dump can pipe output to external commands
-rwxr-xr-xmp6
1 files changed, 5 insertions, 1 deletions
diff --git a/mp b/mp
index 06631cb..62f0e6d 100755
--- a/mp
+++ b/mp
@@ -26,7 +26,11 @@ BEGIN {
} else if ($1 == "key") {
key(v, $2)
} else if ($1 == "dump") {
- for (k in v) print k " '" v[k] "'"
+ if ($2 ~ /^\|/) {
+ cmd = substr($0, 1+index($0, "|"))
+ for (k in v) print k " '" v[k] "'" | cmd
+ close(cmd)
+ } else for (k in v) print k " '" v[k] "'"
} else if ($1 == "parse_string") {
delete v
sub(/^[[:space:]]+/, "")