T wrote:
Hi,the command printf seems to be ignoring the ending '\n' that passes to it: [...]
It's an interaction between the echo command and the shell that's causing the trailing \n to be removed. Printf is working just fine:
$ printf "hello\n" | od -t x1 - 0000000 68 65 6c 6c 6f 0a 0000006 This is the correct output. But what happens when you use echo: $ echo -n `printf "hello\n\n\n\n\n"` | od -t x1 - 0000000 68 65 6c 6c 6f 0000005Avoid using "echo" when you need trailing whitespace; instead, write the data to files:
$ printf "1\n a\n" > file1 $ printf "<end>" > file2 $ cat file1 file2 HTH Sumo