aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.com>2021-12-18 07:56:07 +0200
committerkaotisk <kaotisk@arching-kaos.com>2021-12-18 07:56:07 +0200
commit73125773584e562b07e2246aa2e11838b0ce7052 (patch)
treef8da017002d212e36c7d896ee9cff8229401a4b5
parent00d341f72b8a1ef978810b57fc2305aaf7008872 (diff)
downloadarching-kaos-tools-73125773584e562b07e2246aa2e11838b0ce7052.tar.gz
arching-kaos-tools-73125773584e562b07e2246aa2e11838b0ce7052.tar.bz2
arching-kaos-tools-73125773584e562b07e2246aa2e11838b0ce7052.zip
Simple pipeline using sed
Inputs a json object with keys and values Outputs a bash like assigning to variables
-rwxr-xr-xjson2bash11
1 files changed, 11 insertions, 0 deletions
diff --git a/json2bash b/json2bash
new file mode 100755
index 0000000..347ca93
--- /dev/null
+++ b/json2bash
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# json2bash
+#
+# Kaotisk Hund <kaotisk/kaotiskhund>
+#
+# Strips " , { } from input and replaces ":" with =
+#
+# Usage:
+# ipfs cat <hash> | json2bash
+sed -e 's/{//g' | sed -e 's/}//g' | sed -e 's/":"/=/g' | sed -e 's/"//g' | sed -e 's/,//g' | sed -e 's/ //g'