Bash script: Appending text at the last character of specific line of a file

前端 未结 2 1163
情书的邮戳
情书的邮戳 2021-01-15 01:13

I am trying to append a variable at the last character of a specific line of a file from a bash script.

The file is called myfile.txt and what I want to

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-15 01:41

    Try

    sed -e "s/^MYVERSION=/MYVERSION=.*$/&${VERSION}/g" < myfile.txt
    

    The command appends the value of VERSION to the line with 'MYVERSION='

提交回复
热议问题