Hi. I have got a bit of a problem that I need some help with, and it has been bugging me all afternoon. I need to add the contents of a variable to every line in a text file, using a bash script. For example, if the original file contained:
and the variable contained something like "Hello", how would I go about producing something like this:
(I am not really concerned about the space in the middle.)
It has to use a variable, because the variable is taken from what the user types in to the computer.
I have so far tried using:
cat $VAR file1 | cat > file2
But I need the Hello on every line.
I have also tried:
I'm sorry if my question is a bit vague, but I really need help with this, and have tried everything I can think of. Thanks, in advance, for any advice or help given. It is greatly appreciated.