I am trying to update a file on a server where the new line needs to have a single tab at the front but new to bash scripting and sed and keep getting an unwanted character at the front.
This is the sed command:
sed -i "/acl \"trusted\" {/a&\t$ACL_IP; # $SRV_HOST_NAME" $ACL_CONF_FILE
In the results I get :
& 192.12.12.12; # SERVER
192.13.13.13; # SERVER1
192.14.14.14; # SERVER2
Instead of :
192.12.12.12; # SERVER
192.13.13.13; # SERVER1
192.14.14.14; # SERVER2
I also tried the following but get an unknown command error:
sed -i "/acl \"trusted\" {/$ACL_IP # $SRV_HOST_NAME;\r\n\tacl \"trusted\" {/" $ACL_CONF_FILE
I have tried also:
sed -i "/acl \"trusted\" {/a/\t$ACL_IP; # $SRV_HOST_NAME" $ACL_CONF_FILE
But get:
/ 192.12.12.12; # SERVER
hoping I am close but just can't see to get rid of the extra character.