The situation is as follows, I have 3 variables available:
numlinha
- > line number to replace
texto
- > text of the line to be replaced (I would prefer to use the line number but this is here if I can)
texto_sub
- > text that is going to be replaced
The purpose is to replace a line of the file file.txt, if I can, I can use another search variable instead of the entire line.
I tried to do something like sed -i '/$texto/c\$texto_sub' file.txt
but it does not work in bash script.
The ideal solution for me was to replace with the line number but nothing I tried and saw worked.