Yes, I realized that when I provided the quick-and-dirty solution. With that, I merely wanted to point out the alternative way of changing the output terminator, especially when printing output is of concern.
Beyond the OP, we really can't tell how thorough a solution is required. For instance, we had to assume that
was the filename in itself and not part of the file contents.