I have the next code:
command[check_ping]=/usr/lib64/nagios/plugins/check_ping -w $ARG1$ -c $ARG2$
command[check_filemtime]=/usr/lib64/nagios/plugins/check_filemtime $ARG1$
command[check_iostat]=/usr/lib64/nagios/plugins/check_iostat $ARG1$ $ARG2$
command[check_open_files]=perl /usr/lib64/nagios/plugins/check_open_files.pl -w $ARG1$ -c $ARG2$
command[check_itai]=/usr/lib64/nagios/plugins/itai
command[check_mem]=perl /usr/lib64/nagios/plugins/check_mem.pl -w $ARG1$ -c $ARG2$_
command[check_uptime]=/usr/lib64/nagios/plugins/check_uptime
command[check_ifstatus]=/usr/lib64/nagios/plugins/check_ifstatus -w $ARG1$ -c $ARG2$
command[check_local_load]=/usr/lib64/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
command[check_local_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
From within vim editor, I'd like to add an escaping char "\"
before each $ARG
argument so I tried this command:
:81,129!sed -e "/\<\$A/\<\\$A"
, but what happens is that these lines (81-129) disappear and the error from the sed
command is written in line #81, what am I doing wrong?
81-129 are the relevant line numbers in the file
vim
can do the regex searching & replacing. So, you do not need to use external tool like sed
. You can simply write as,
:81,129s/ \$ARG/ \\$ARG/g