且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

shell sed-在已知字符串和通用定界符之间替换未知字符串

更新时间:2023-11-15 15:52:04

这将适用于值中的一个或不带引号的 part (带引号的部分前后都有未引号的部分):

This will work for one or none quoted part in the value (unquoted parts before and after the quoted part):

sed -i '/software/ s/setting:[^,"]*("[^"]*")?[^,"]*,/setting:,/' $fileName