I am having a hard time with this one. I am trying to use a for loop to update a specific line in a handful of session files. The line in the session files I am looking to append is:
The 'hostlist' file has a list of hosts. Each line in the 'hostlist' file is unique and matches exactly to the output of 'ls'.
Here's what I have thus far:
for i in $(ls); do sed 's/HostName\=/HostName\=$HOST/g' $i > $i.temp; done
It doesn't matter whether I use no quotes, single quotes or double quotes, it either will add the literal $HOST to the files or nothing at all.
Since the line I am wishing to replace is the same in every file, I have also tried line replacement in sed with similar results:
sed '2 r $HOST' $FILE > $FILE.temp
Thank you in advance!