clean_json and json_text are working
[feisty_meow.git] / scripts / core / functions.sh
index cbd9dbe074239fe29a0d22f9a3f2439d228582c7..5771586fb47ed99143b0277aca1093da9085760b 100644 (file)
@@ -743,7 +743,7 @@ return 0
   }
 
   # pretty prints the json files provided as parameters.
-  function json_view()
+  function clean_json()
   {
     if [ -z "$*" ]; then return; fi
     local show_list=()
@@ -760,6 +760,16 @@ return 0
     rm "${show_list[@]}"
   }
 
+  function json_text()
+  {
+    # only print our special headers or text fields.
+    local CR=$'\r'
+    local LF=$'\n'
+    clean_json $* |
+        grep -i "\"text\":\|^=.*" | 
+        sed -e "s/\\\\r/$CR/g" -e "s/\\\\n/\\$LF/g"
+  }
+
   ##############
 
   # NOTE: no more function definitions are allowed after this point.