Solved

How do you add a space between the data when combining text files together?

Posted on 2014-09-12
6
290 Views
Last Modified: 2014-09-18
How do you add a space between the end of the data and the start of data when combining text files?

For example:
copy *.txt newfile.txt

The result is that all the date is in succession one after another, and there are no spaces at all after the end of the data from the first text file and the beginning of the data in the next text file and so forth.

Is there a way to add this?
0
Comment
Question by:100questions
6 Comments
 
LVL 47

Expert Comment

by:Vitor Montalvão
ID: 40319431
You made be remember my good days of DOS :)
Unfortunaly I couldn't find a way to add a space so my example is with a minus (-) character.
for %f in (*.txt) do copy /Y newfile.txt+%f newfile.txt & echo - >> newfile.txt

Open in new window

0
 
LVL 47

Expert Comment

by:Vitor Montalvão
ID: 40319461
New version. See if this one it's better for you (echo. instead of echo -):
for %f in (*.txt) do copy /Y newfile.txt+%f newfile.txt & echo. >> newfile.txt

Open in new window

0
 
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 40319470
Try:
del merged.txt

for %%I in (*.txt) do (
    type %%I >> merged.tmp
    echo. >> merged.tmp
    echo. >> merged.tmp
)

ren merged.tmp merged.txt

Open in new window

0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 500 total points
ID: 40319526
A useful one sometimes can be to use FIND with /v to exclude all but certain lines, if you specify "" then you end up with the whole file but with a nice delimeter between them with the filename:

find /v "" *.txt > new.log
type new.log

Open in new window


---------- 1.TXT
1

---------- 2.TXT
2

---------- 3.TXT
3

Open in new window


hth

Steve
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 40319528
And if you want just a blank line:

find /v "" *.txt | find /v "---------- "

Steve
0
 

Author Closing Comment

by:100questions
ID: 40330569
Thank you.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question