Use a variable in a sed command

后端 未结 6 1366
梦谈多话
梦谈多话 2020-12-09 03:15

I can\'t seem to use a variable in a sed command, for example:

sed \"24s/.*/\"$ct_tname\"/\" file1.sas > file2.sas

I want $ct_tnam

6条回答
  •  温柔的废话
    2020-12-09 03:59

    Shell variables are not expanded inside single quotes. Try this instead:

    sed "24s/.*/\"$ct_tname\"/" file1.sas > file2.sas
    

提交回复
热议问题