sed: Replace part of a line

后端 未结 7 2089
渐次进展
渐次进展 2020-12-05 09:53

How can one replace a part of a line with sed?

The line

DBSERVERNAME     xxx

should be replaced to:

DBSERVERNAME           


        
7条回答
  •  时光取名叫无心
    2020-12-05 10:17

    You shouldn't be escaping your parens. Try:

    echo "DBSERVERNAME    xxx" | sed -rne 's/(dbservername)[[:blank:]]+([[:alpha:]]+)/\1 yyy/gip'
    

提交回复
热议问题