I tried both single and double quotes hoping that the variable will expand. Did not know that behavior of grep.
Inside each .cfg file there are tens or hundreds of lines. I am interested in getting the line that start with hostname and followed by the device name. So, the line would like like this:
Now, I need to look for the hostnames that are in the other file located in /tmp/namelist
I tried your suggestion, but echoing the variable on my for do loop does not append to: grep -i '^hostname'
Again, I am trying to find out in each *.cfg file the line that start with:
hostname <for each hostname in file /tmp/namelist>
there is only one of these line in each *.cfg file. Like I said, I have thousand of files to look for, hence I tried the for do loop.
Thank you for your comments and help.