Have you ever wanted to merge a bunch of text files together into one large one? For example, if you use a tool to go grab a bunch of show command results and output it to a text file per device, it’s handy if you can have the operating system merge all that together for you. Many of you have likely done this at one point or another, but I figured it was worth capturing here to share the syntax. To learn how to concatenate multiple text files into one in Windows, read on:
From a Windows command prompt, you can use the type command to output the contents of a file.
C:\>type file1.txt Beginning of file1.txt ... End of file1.txt ----------------
To merge multiple files use the type command plus the double arrows to merge a bunch of files:
C:\>type *.txt >> output.txt file1.txt file2.txt file3.txt
This leaves you with all the original files plus a new one called output.txt. That’s all there is to it!
Here’s a video demonstration of how to do this:
Have another way to concatenate multiple text files into one in Windows? Leave a comment below and share it with us!I just learned a totally simple way to merge a bunch of text files in Windows! Click To Tweet
- Tags: CLI, file management, text, windows