I have encountered a strange issue in concatenating the files using the cat command. I have two files with one string in each of them:
file1:
ABC
file2:
DEF
Either I do cat file1 file2 or I do cat file1 >> file2. I expect an output as shown below:
ABC
DEF
However, I have a funny output like this:
ABCDEF
I have checked the files and there is no extra space or characters. However, when I do manual deleting from the back of the string, I don't even see a single character. It works fine. I suppose there must be some kind of "hidden" character or line which I can't see.
It has been bugging me a lot because I have tons of files to concatenate. I can't do the same thing manually.
Any help is appreciated.
file1does not have a trailing newline\n- (perhapsfile2is the same). Testfile1via:hexdump file1, and look for0aat the end.0ais the hexadecimal value of the newline charactered "$file" <<< wwill write trailing new lines to a file lacking one.