I have a variable with dollar signs in it:
ipvar_definitions="
var SSH_SERVERS \$HOME_NET
var FTP_SERVERS \$HOME_NET
var SIP_SERVERS \$HOME_NET
"
I want to append the value of this variable after a match using sed or perl or whatever one liner I can use.
When trying with sed using the code below:
sed "/var SNMP_SERVERS/a ${ipvar_definitions}" /etc/snort.conf
I get this error:
sed: -e expression #1, char 24: expected newer version of sed
I get this error because my variable has dollar signs in it. I'd like to solve this in a one liner using sed, perl, awk or whatever I can use.
For clarification I am posting a sample input and the expected output:
Input:
# List of snmp servers on your network
var SNMP_SERVERS $HOME_NET
# Configure your service ports. This allows snort to look for attacks destined
Expected output:
# List of snmp servers on your network
var SNMP_SERVERS $HOME_NET
var SSH_SERVERS $HOME_NET
var FTP_SERVERS $HOME_NET
var SIP_SERVERS $HOME_NET
# Configure your service ports. This allows snort to look for attacks destined
sedversion requiring a backslash before each literal newline you want to insert.