Concatenate two files without adding a newline

catnewlinestext processing

If I nano two files, one of which reads 'this' without me entering a newline, and one of which reads 'is' without me entering a newline, I want to be able to then cat the two files together into something like 'thisis'.

Instead, the newlines are inserted automatically.

alec@ROOROO:~/$ cat test1 test2 > test3
alec@ROOROO:~/$ cat test3
this
is

So, how can I concatenate two files without adding a newline?

Best Answer

Those trailing newlines are added by nano, not by cat.

Use nano's -L parameter:

-L (--nonewlines)
    Don't add newlines to the ends of files.

Or ~/.nanorc's nonewlines command:

set/unset nonewlines
    Don't add newlines to the ends of files.
Related Question