I have a bunch of
.text files, most of which end with the standard nl.
A couple don't have any terminator at end. The last physical byte is (generally) an alphameric character.
I was using
cat *.text >| /tmp/joined.text, but then noticed a couple of places in joined.text where the first line of a file appeared at the end of the last line of a previous file. Inspecting the previous file, I saw there wasn't a line terminator -- concatenation explained.
That raised the question, what's the easiest way to concatenate, sticking in the missing newline? What about these options?
- A solution that might effectively add a blank line to some input files. For me, that's not a problem as the processing of joined.text can handle it.
- A solution that adds the cr/fl only to files that do not already end that way.
whileis skipping those broken last lines.
\n? On *nix systems, lines end with a single
\r\nis a Windows thing. And where do you want this? At the end of each line? The end of the file?