summaryrefslogtreecommitdiff
path: root/postpost/adj_input_param_pipe
diff options
context:
space:
mode:
Diffstat (limited to 'postpost/adj_input_param_pipe')
-rwxr-xr-xpostpost/adj_input_param_pipe29
1 files changed, 29 insertions, 0 deletions
diff --git a/postpost/adj_input_param_pipe b/postpost/adj_input_param_pipe
new file mode 100755
index 0000000..76d37bb
--- /dev/null
+++ b/postpost/adj_input_param_pipe
@@ -0,0 +1,29 @@
+#!/bin/sh
+# usage: cat fromfile | ./adj_input_param &key name value > tofile
+
+neof=true
+todo=0
+while $neof
+do
+ read s || neof=false
+ case $todo in
+ 0)
+ [ "$s" == "$1" ] && todo=1
+ ;;
+ 1)
+ if [ $(echo "$s" | grep -c "^ *$2 ") -eq 1 ]
+ then
+ echo -ne "$s" | sed "s/=.*$//"
+ echo -ne "= "
+ echo -ne "$3"
+ echo "$s" | sed "s/ *#.*$/\n&/" | tail -n1
+ todo=2
+ continue
+ fi
+ [ $(echo "$s" | grep -c "^&") -eq 1 ] && todo=2
+ ;;
+ 2)
+ esac
+ echo "$s"
+done
+