I have a loop in the script below. It is not working as I want. I need to put the $LINE value in front of each column. While it puts "$LINE" instead of it is value:
cat list | while read LINE ; do
sed 's/^/$LINE\t/g' $LINE.alf > $LINE.joined
done
I have a loop in the script below. It is not working as I want. I need to put the $LINE value in front of each column. While it puts "$LINE" instead of it is value:
cat list | while read LINE ; do
sed 's/^/$LINE\t/g' $LINE.alf > $LINE.joined
done
It will not expand variables in side of a single quoted '
string. Try:
cat list | while read LINE ; do
sed 's/^/'"$LINE"'\t/' $LINE.alf > $LINE.joined
done
"s/^/$LINE\t/"
andg
flag is not needed as start of line can be matched only once – Sundeep Jan 25 '17 at 05:29