About MEDITECH Reports

 

View John Sharpe's profile on LinkedInI'm your host, John Sharpe, a MEDITECH Consultant living in Spokane, WA. Read more ...

Connect ...

Expand your network by connecting on these social media sites:

Sign up for the MEDITECH Reports Blog; details to attend MEDITECH workshops are sent out 1 week in advance to all MEDITECH Report blog subscribers.

These MEDITECH Workshops are sponsored by Donna Carroll at the MEDITECH Community Bulletin

MEDITECH NPR & RW RESOURCES:

Ascii Table: For NPR Report Writer
Loop Builder: For NPR Macros
Key Codes: For CDS Attributes
List Builder: For NPR Macros
MT Report Names: For NPR Reports
MT Structure Viewer: For Physicals
Strings: Format & Sort

HIT Topics

MEDITECH Reports

Current Articles | RSS Feed RSS Feed

How To Merge Flat Meditech Data Files - 101

 

To quickly combine multiple files, place the files you want to combine in a new folder.

Meditech Flat Files Merge

Open a command prompt: click your Start button Meditech Start Button, click Run Meditech Run Line, type cmd.  Use the CD (Change Directory) command to navigate to the folder where your files are stored.

Use the DIR command to create a file with a list of the text files in this folder: dir *.txt >Dir.txt. Close your command prompt, by clicking on the X as shown: Close Meditech.

Meditech Command Line

Using a text editor, copy the file names from Dir.txt into a new text file.

Meditech Files Directory

Save the new file as CombineFiles.bat in your directory with the other files.

Combined Meditech File List

Using copy /b combine all file names in a + delimited list onto the first line of the CombineFiles.bat file.  After your list of files, type a space and then the name for your new large file which will contain the contents of the other files.

Example 1: copy /b Data-File-0.txt+Data-File-1.txt+Data-File-2.txt+Data-File-3.txt+Data-File-4.txt+Data-File-5.txt+Data-File-6.txt+Data-File-7.txt+Data-File-8.txt+Data-File-9.txt+Data-File-10.txt+Data-File-11.txt New-Large-File.txt This will combine the files in the exact order you've expressed in your + delimited list.

Example 2: If file order doesn't matter, copy /b *.txt New-Large-File.txt will copy all files into the new file.

Meditech Batch File

Save and close CombineFiles.bat.  Run CombineFiles.bat by going back to your folder with the files and clicking on CombineFiles.bat.  Running this file is known as executing a batch file. 

Meditech Batch File Running 

When the batch file completes (this can take a while if your files are large), your command prompt will close by itself.  Go back to your folder to find your new file containing the contents of the other files, if you’ve followed the naming convention above, the file will be named: New-Large-File.txt.

Large Meditech File

There: we’ve successfully combined 10 flat data files into 1 large data file, just like that.

Want an alert when the next post is published? Click the phone and Subscribe to the MEDITECH Reports Blog!

Subscribe to the Meditech Blog     

                                                                                                                                                                                                          

Comments

This could be handy when I combine data from different dpm's and report, but my vendor wants the files combined. Thanks.
Posted @ Wednesday, February 01, 2012 8:01 AM by Lori Kent
Interesting how learning small things like this can save you so much time especially when working with large data sets.  
 
 
 
Thanks for the comment!
Posted @ Wednesday, February 01, 2012 12:28 PM by John Sharpe
Sidenote: In C/S 5.6x MIS Report Scheduler, when you set up a report to be downloaded, there is an option to append the output to the destination file if it already exists. For other situations, yeah, I can using this tip. Thanks for sharing! How much DOS have we all forgotten over the years?
Posted @ Sunday, February 05, 2012 11:11 AM by Craig LeBeau
That's a new one to me, thanks for sharing Craig!
Posted @ Sunday, February 05, 2012 9:46 PM by John Sharpe
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics