Link to home
Start Free TrialLog in
Avatar of Wildbi11
Wildbi11Flag for United States of America

asked on

Use DOS to combine text files

This is a two part question.  I am performing some data mining
routines for a client who has provided the following system
configuration:

Windows 7-64Bit
8Gig of Ram
Monarch v 10.5
Office 2007

Part 1:
I have several text files that I am combining with the following
name structure:
"xxxx xx xxxxxx.txt"

Within a batch file I issued the following command line:
COPY *.Txt "H13P46 LDistrb YTD.Txt"
This command works fine but select files within the combined file
are rejected by Monarch as exceeding "4000 character line"
None of the lines are greater than 256 characters - not sure what is causing
the error.  Combine works fine except Monarch cannot read it.

However, Monarch can read each individual file without any problems.

==============================================================================
Part II:
To alleviate the problem above I tried combining the text files as follows:
For %%F in (*.txt) do type %%F >> Output.txt

If I copy the command from within DOS it works fine; AND Monarch has no
problem reading the resultant combined file.
If I try running it from within the batch file it fails to combine the files
because it does not recognize the file name: xxxx xx xxxxxx.txt;
the DOS error states it is looking for only the xxxxxx.txt portion of the name.
I have tried various items such as double/single quotation marks and still no
result.

My goal is to combine multiple text files into one text file and then proceed to
run multiple Monarch routines from within the Monarch Scripting.
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bill Prew
Bill Prew

If you can provide a sample of the individual files, and the COPY *.* output file that reports more than 4000 characters in a line, I'd be interested in looking at those for the potential cause.

~bp
Bill,
I suppose COPY does not forcefully add a line break for the last line (nor an EOF) of each file, and so lines might get concatenated. But just a guess.
Understand Clemo, but I don't think the original files had lines near 2000, so that felt like it might not be the issue.  I thought maybe unix EOL perhaps, but wanted to check out the files in hex to look for anything interesting.  I know you can relate.

~bp
Oops, yes a /F missed there in http:#a40444991 as Qlemo pointed out, said was quick passing comment!

Steve
Avatar of Wildbi11

ASKER

Thanks for the help - you were quick with an answer and "right on" with the solution.