Solved

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

Posted on 2014-09-12
6
288 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 45

Expert Comment

by:Vitor Montalvão
Comment Utility
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 45

Expert Comment

by:Vitor Montalvão
Comment Utility
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
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 500 total points
Comment Utility
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
Comment Utility
And if you want just a blank line:

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

Steve
0
 

Author Closing Comment

by:100questions
Comment Utility
Thank you.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now