I am trying to write a sed
command like below
i=20
sed 's/./&\
\/\/this comment has been automatically added using code and identifying function start\
/$i' zero.swift > out.swift
However, I'm not able to use $i
in the last line. I would have expected it to replace $i with 20 and then run the sed command.
However, when I run the above, I get
"s/./&\
\/\/this commen ...": bad flag in substitute command: '$'
as error. How should I use the variable in my sed command.
I've read other posts on Stackoverflow, which are not helping me