I have tried everything I can think of to get
sed to change line N of a file to the contents of a variable. I have Googled the Internet, and I find lots of people telling how to use variables with the "Substitute" command, but no one telling how to use variables with the "Change" command.
I have considered the possibility of using the "Substitute" command with a wild card for existing text, but my search of the Internet tells me
SED doesn't have wild cards in its repertoire, so it's difficult! There must be a better way.
As I noted in the subject, the basic form I used is (where N is a line number):
Code:
sed -i 'N c\$variable' FILE
Is this possible, or is there a different command that will do it? I am working in BASH scripts.
Thanks!