I have a one-line file with no newline character at the end of the line. When i run the following:
diff oneline-file.txt any-file.txt | wc -c
I get:
Warning: missing newline character in oneline-file.txt
Why is this an error? How can i fix it? I could do this first:
echo "\n" >> oneline-file.txt
I'd rather do something that does not change the file. Thx.
Thanks to Barmar. This steered me in the right direction. Here's what I used:
diff <(sed 's/$/\n/g' oneline-file.txt) <(cat any-file.txt) | wc -c