473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How can I concatenate several text files into a single file?

I need to concatenate serveral text files into a larger file.

I borrowed some code and patched together a batch file that runs in the
command processor and looks like this:

echo off
chdir C:\Documents and Settings\dave\My Documents\SQL\Deploy

rem Create tables
echo Generate CREATE TABLE SQL script [CreateTables.sql] ...

echo PRINT ' Create tables ...' > CreateTables.sql

cat ./Tables/dbo.table1.tab ./Tables/dbo.table2.tab ./Tables/dbo.table3.tab
CreateTables.sql


But it fails with the command "cat" ("'cat' is not recognized as an internal
or external command, operable program or batch file").

Can anyone tell me how I can concatenate my files?
Nov 16 '05 #1
3 7723
Dave,

Programatically, I would just create a new FileStream instance that
represents the new file. Then, I would open up the other files
sequentially, reading the contents from those, and writing the contents to
the new file.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dave" <da**@nospam.ru> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
I need to concatenate serveral text files into a larger file.

I borrowed some code and patched together a batch file that runs in the
command processor and looks like this:

echo off
chdir C:\Documents and Settings\dave\My Documents\SQL\Deploy

rem Create tables
echo Generate CREATE TABLE SQL script [CreateTables.sql] ...

echo PRINT ' Create tables ...' > CreateTables.sql

cat ./Tables/dbo.table1.tab ./Tables/dbo.table2.tab
./Tables/dbo.table3.tab
CreateTables.sql


But it fails with the command "cat" ("'cat' is not recognized as an
internal
or external command, operable program or batch file").

Can anyone tell me how I can concatenate my files?

Nov 16 '05 #2
In C# ??
"Dave" <da**@nospam.ru> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
I need to concatenate serveral text files into a larger file.

I borrowed some code and patched together a batch file that runs in the
command processor and looks like this:

echo off
chdir C:\Documents and Settings\dave\My Documents\SQL\Deploy

rem Create tables
echo Generate CREATE TABLE SQL script [CreateTables.sql] ...

echo PRINT ' Create tables ...' > CreateTables.sql

cat ./Tables/dbo.table1.tab ./Tables/dbo.table2.tab
./Tables/dbo.table3.tab
CreateTables.sql


But it fails with the command "cat" ("'cat' is not recognized as an
internal
or external command, operable program or batch file").

Can anyone tell me how I can concatenate my files?

Nov 16 '05 #3
If the file size is within gigabytes, use the DOS's "COPY" command:
copy file1+file2+file3 destinationfile.

It seems that I post the answer in the wrong group. :~)
"Dave" <da**@nospam.ru> ¼¶¼g©ó¶l¥ó·s»D:%2***************@TK2MSFTNGP15.phx. gbl...
I need to concatenate serveral text files into a larger file.

I borrowed some code and patched together a batch file that runs in the
command processor and looks like this:

echo off
chdir C:\Documents and Settings\dave\My Documents\SQL\Deploy

rem Create tables
echo Generate CREATE TABLE SQL script [CreateTables.sql] ...

echo PRINT ' Create tables ...' > CreateTables.sql

cat ./Tables/dbo.table1.tab ./Tables/dbo.table2.tab
./Tables/dbo.table3.tab
CreateTables.sql


But it fails with the command "cat" ("'cat' is not recognized as an
internal
or external command, operable program or batch file").

Can anyone tell me how I can concatenate my files?

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mike James | last post by:
I admit it. I'm a newbie... I want to concatenate a series of text files by recursively going down a folder hierarchy. All the files have the same extension (*.txt) and I'm running WinXP Home...
5
by: gwarning! | last post by:
Goal: Have multiple text files, each of various lengths, be concatenated together into one final consolidated text file. Problem: Since the names of the files to be concatenated can change from...
13
by: jt | last post by:
I can't seem to find a way to concatenate strings that have nulls within the string. I have a string that I need another string that has nulls in it and what to append the 2nd string, 3 string...
14
by: J.S. | last post by:
In a Windows Form application, which is the better method to concatenate large blocks of code? 1. Reading the text from text files. 2. Adding the text to the VB file itself? Thanks! J.S. ...
22
by: petermichaux | last post by:
Hi, I'm curious about server load and download time if I use one big javascript file or break it into several smaller ones. Which is better? (Please think of this as the first time the scripts...
2
by: ffimbel | last post by:
Hi, I would like to find out the fastest way to concatenate large (200 or 300MB) and numerous (500 - 700) files (Postscript files) into a single one (which can ends up being several GigaB)...
4
by: Dan | last post by:
Hi all, I am creating a search table where the keywords field is made up of several text fields and this is causing me some problems. I can concatentate the text ok but i can't seem to concatenate...
4
by: idiotprogrammer | last post by:
I have a rather basic question to ask. It reflects a lack of understanding of how you solve problems with xml. But bear with me. I'm a technical writer interested in producing good source code...
1
by: kgk | last post by:
I would like to concatenate several file-like objects to create a single file-like object. I've looked at fileinput, however this returns a fileinput object that is not very file-like. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.