I am just trying to print bash variable in awk statement as string
here is my script
n=1
for file in `ls *.tk |sort -t"-" -k2n,2`; do
ak=`(awk 'FNR=='$n'{print $0}' res.dat)`
awk '{print "'$ak'",$0}' OFS="\t" $file
n=$((n+1))
unset ak
done
I am getting following error
awk: line 1: runaway string constant
is there any solution to read reference file first line print with 1st file(in loop) $0, then read 2nd line from reference file print with 2nd file in loop