cat test.txt

$config['useragent'] = 'Roundcube Webmail'; // Hide version number
//$config['username_domain'] = 'www.b.com';  #要去掉前面的//
$config['mime_types'] = '/etc/mime.types';

 

sed -i '/\/\/$config.*username_domain/ s&//&&g' test

 

文件中有这样一句置换对象

http://www.aaa.com/top.jsp?_para1=ture&_para2=false&_para3=ok

希望最后置换成 

http://www.aaa.com/top/?_para1=ture&_para3=ok

sed -i '/http:\/\/www\.aaa.com/ s#.jsp?_para1=ture&_para2=false&_para3=ok#/?_para1=ture\&_para3=ok#' test.txt     #关键& 要转译

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案