I have several text files in a single folder, and I would like to merge only certain sequential files into one long one (where one file comes immediately after the next).
For example, I want to merge all files starting with test (so test1.txt, test2.txt, test3.txt, and so on) into one file named file.out, like so:
Stuff from test1
Stuff from test2
...
Stuff from testN
I tried cat * > file.out, but that merges everything, which is not what I want. How can I do this?
pastecommand – Sergiy Kolodyazhnyy Jan 15 '17 at 06:16cat test* > out.file. – Kaz Wolfe Jan 15 '17 at 06:17abc+defintoadbecfis quite different fromabcdef. Exactly like the accepted answer in the linked dup reflects (the first output). This question asks for the second output. – Jacob Vlijm Jan 15 '17 at 09:56