I have the following bash code which loops through a text file, line by line .. im trying to prefix the work \'prefix\' to each line but instead am getting this error:
You don't need sed, just concatenate the strings in the echo command
while IFS= read -r line; do echo "prefix$line" done < filename
Your loop iterates over each word in the file:
for line in `cat file`; ...