sed: Replace part of a line

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

    This might work for you:

    echo "DBSERVERNAME     xxx" | sed 's/\S*$/yyy/'
    DBSERVERNAME     yyy
    

提交回复
热议问题