Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9082

Merge multiple files into 1 file with a newline character between the contents of each file in command line

$
0
0

I've got for example 2 files with the contents

test.txt

1

test2.txt

2

I want to merge these 2 files into one file.I saw on related questions that it was recommended to use

type *.txt > merged.txt

however this would result in a file with the contents of 12 without a newline character in between which I heard the type command was supposed to do

edit:I solved the problem by modifying Luis's answer and making a batch file and subfolder for the files I want merged

@echo offtype nul > merged.txtFOR /R .\files %%f IN (*) DO (type "%%f" >> merged.txt) && (echo. >> merged.txt)  

Viewing all articles
Browse latest Browse all 9082

Trending Articles