Wednesday 13 March 2019

linux - How can I combine several files into one?


How can I collect several files into a single file?


I tried GZip, but could only get it to create separate files.


It does not have to be compressed.



Answer



Simply use cat:


cat file1 file2 file3 > output

If you want to combine all files in the current directory:


cat * > output

If you need to adjust the order of the files in the output, use echo first to get all filenames:


echo *

Then supply them in the desired order to cat.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...