sed: Replace part of a line

后端 未结 7 2097
渐次进展
渐次进展 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:00

    Others have already mentioned the escaping of parentheses, but why do you need a back reference at all, if the first part of the line is constant?

    You could simply do

    sed -e 's/dbservername.*$/dbservername yyy/g'
    

提交回复
热议问题