echoing complex awk command into file fails

view full story

http://www.unix.com – Using hp-ux's shell, I'm trying to echo a complex awk command into a script file for later use. But it fails on a newline character and splits the rest of the command onto the next line. Code: echo '    printf("%s: TOTAL = %18.0lf\n", FILENAME, TOTAL) >> "TOTAL.TXT";'      >>awk.script Looks like this in awk.script: printf("%s: TOTAL = %18.0lf ", FILENAME, TOTAL) >> "TOTAL.TXT"; But it's missing the \n and should be all on one line. Thanks for your help. (HowTos)