Use a variable in a sed command

后端 未结 6 1405
梦谈多话
梦谈多话 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:52

    In my case, i just remplaced single quotes by the double ones:

    for a in $(cat ext.cnf); do sed -n "/$a$/p" file1 >> file2; done
    

    For now, it's working well...

提交回复
热议问题