Reputation: 3663
When I run cat 1.txt 2.txt > result.txt
, I want result.txt
to have a linebreak between the end of the contents of 1.txt
and the beginning of the contents of 2.txt
. How do I do this?
Upvotes: 0
Views: 126
Reputation: 3724
One of many options is:
echo | cat 1.txt - 2.txt > result.txt
The - argument says 'accept standard input' and the echo provides the new line
This option only works cleanly for 2 files. If you are actually looking at many files etc then for example:
(cat 1.txt; echo; cat 2.txt; echo; cat 3.txt) > result.txt
Would work; It's worth noting this spawns more cat processes.
Upvotes: 2