Wildbi11
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
~bp
Oops, yes a /F missed there in http:#a40444991 as Qlemo pointed out, said was quick passing comment!
Steve
Steve
ASKER
Thanks for the help - you were quick with an answer and "right on" with the solution.
~bp