diff options
author | simulation <simulation@nlo-ext3.ioq.uni-jena.de> | 2016-02-09 09:54:46 +0100 |
---|---|---|
committer | simulation <simulation@nlo-ext3.ioq.uni-jena.de> | 2016-02-09 09:54:46 +0100 |
commit | 6be0f285adb27f60f058c2937a7885899e17cb88 (patch) | |
tree | be50a15314fe28c5b7b8f721233a34e71ca5b3b4 /postpost/adj_input_param_pipe | |
download | lpic-master.tar.xz |
Diffstat (limited to 'postpost/adj_input_param_pipe')
-rwxr-xr-x | postpost/adj_input_param_pipe | 29 |
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 + |