After a lot of trying the past day, I can't make following command work on 1 line:
sed '/'"$var1"'/ {n;n;a '\'"$var2"\'' \\ 
}' tempproject.cfg
when i run this like above, it matches $var1 and replaces the 3rd line after it with $var2.
example of what the sed command should do:
  var1=c
  var2=hello
a                                                              a
b                                                              b         
c                                                              c
d      =>     sed '/'"$var1"'/ {n;n;a '\'"$var2"\'' \\  =>     d
e              }' tempproject.cfg                              e
f                                                              'hello' \
g                                                              g
h                                                              h
when i put the command on 1 line i get the following error:
sed: -e expression #1, char 0: unmatched `{'
Thanks in advance!