Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2014-09-12
6
291 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 48

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 48

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
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.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
parental control on huwei HG658b 1 26
New User Account Creation Issue 4 36
Windows Installer (VBSCRIPT) Rename Printer 3 31
Outlook 2010 meeting recurrances 26 11
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…
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
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 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.

856 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