Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

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

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
100questions
Asked:
100questions
2 Solutions
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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
 
Gabriel CliftonCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Steve KnightIT ConsultancyCommented:
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
 
Steve KnightIT ConsultancyCommented:
And if you want just a blank line:

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

Steve
0
 
100questionsAuthor Commented:
Thank you.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now