ip04 working version
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 29 Oct 2012 04:07:35 +0000 (04:07 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 29 Oct 2012 04:07:35 +0000 (04:07 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@889 01035d8c-6547-0410-b346-abe4f91aad63

mini-asterisk-gui2/cgi-bin/setlinekey2.cgi

index 673f876086933d0f7367034650c8071f39eccf11..8687ee27dfac68a6f7d4dad7c04d1887c2fa9838 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh -x
-# setlinekey.cgi
+# setlinekey2.cgi
 # David Rowe 29 Oct 2012
 #
 # CGI to set the text in "file" from "this" to "that"
@@ -31,7 +31,8 @@ echo $that
 echo $key
 if [ -f $file ]; then
 #  sed -i  "s/\($this\)[a-z0-9\.]*\(.*$key.*\)/\1$that\2/"  $file
-  cat $file | sed "s/\($this\)[a-z0-9\.]*\(.*$key.*\)/\1$that\2/"
+rhs=`cat $file | grep -oe "host=[a-z0-9\.]*" | sed -n "s/host=//p"`
+cat $file | sed "s/$rhs/$that/"
 else
   echo "$file does not exist"
 fi