Skip to content
Advertisement

Concatenating Files And Insert New Line In Between Files

I have multiple files which I want to concat with cat. Let’s say

JavaScript

I want to concat so that the final file looks like:

JavaScript

Instead of this with usual cat File*.txt > finalfile.txt

JavaScript

What’s the right way to do it?

Advertisement

Answer

You can do:

JavaScript

Make sure the file finalfile.txt does not exist before you run the above command.

If you are allowed to use awk you can do:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement