Asked • 05/26/19

Concatenate multiple files but include filename as section headers?

I would like to concatenate a number of text files into one large file in terminal. I know I can do this using the cat command. However, I would like the filename of each file to precede the "data dump" for that file. Anyone know how to do this? what I currently have: file1.txt = bluemoongoodbeer file2.txt = awesomepossum file3.txt = hownowbrowncow cat file1.txt file2.txt file3.txt desired output: file1 bluemoongoodbeer file2 awesomepossum file3 hownowbrowncow

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.