sed: Replace part of a line

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

    You shouldn't be escaping things when you use single quotes. ie.

    echo "DBSERVERNAME    xxx" | sed -rne 's/(dbservername[[:blank:]]+)([[:alpha:]]+)/\1 yyy/gip'
    
    0 讨论(0)
提交回复
热议问题