Linux 在多个文件中的现有字符串周围添加引号
我想在multiples文件中的现有字符串周围添加双引号 检查你的网址!MA100MLPAL002-第8080页-u/apollo/info?部分=错误 我想在第一个“-u”之后,但在/之前和之前添加一个引号!。是的 检查你的网址!MA100MLPAL002-第8080页-u“/apollo/info?section=错误” 我尝试过sed替换,但不符合标准Linux 在多个文件中的现有字符串周围添加引号,linux,shell,awk,sed,Linux,Shell,Awk,Sed,我想在multiples文件中的现有字符串周围添加双引号 检查你的网址!MA100MLPAL002-第8080页-u/apollo/info?部分=错误 我想在第一个“-u”之后,但在/之前和之前添加一个引号!。是的 检查你的网址!MA100MLPAL002-第8080页-u“/apollo/info?section=错误” 我尝试过sed替换,但不符合标准 define service { host_name ma100mlpapl0
define service {
host_name ma100mlpapl002
servicegroups Environment URL
service_description http://ma100mlpapl002:8080/apollo/info?section=ERROR
display_name http://ma100mlpapl002:8080/apollo/info?section=ERROR
check_command check_envurl!ma100mlpapl002!-p 8080!-u /apollo/info?section=ERROR!!!!!
max_check_attempts 3
check_interval 15
retry_interval 1
check_period 24x7
contact_groups siteops
sed '/pattern/a some text here' filename
试试这个:
$ sed 's/-u \([^!]*\)!/-u "\1"!/' <<< 'check_envurl!ma100mlpapl002!-p 8080!-u /apollo/info?section=ERROR!!!!!'
check_envurl!ma100mlpapl002!-p 8080!-u "/apollo/info?section=ERROR"!!!!!
$sed's/-u\([^!]*\)/-u“\1”!/'