When I am using awk command to insert a line it is giving unterminated string error.
input file is like
date mean rms bias
..... ..... .... .......
..... ..... ........ .........
...... ........ ....... .......
Here I need to insert new values of date, mean, rms and bias.
my script is like this
echo $PDY $mean $rms $bias
awk '/Date/ { print; print "'$PDY' \t'$mean' \t'$rms' \t'$bias'"; next }1' file.txt
Terminal log is like this
+ echo 20180131 76.196 578.177 903.000
20180131 76.196 578.177 903.000
+ awk '/Date/ { print; print "20180131 \t' '76.196 \t578.177 \t903.000"; next }1' file.txt
awk: /Date/ { print; print "20180131 \t
awk: ^ unterminated string
There is a ' ' (gap/space) coming after print; print "20180131 \t
in my awk command. I don't know why it is coming
Please give me a solution.