473,803 Members | 2,946 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\M y Documents\SQL\D eploy

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

echo PRINT ' Create tables ...' > CreateTables.sq l

cat ./Tables/dbo.table1.tab ./Tables/dbo.table2.tab ./Tables/dbo.table3.tab
CreateTables.sq l


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 7756
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.co m

"Dave" <da**@nospam.ru > wrote in message
news:%2******** *******@TK2MSFT NGP15.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\M y Documents\SQL\D eploy

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

echo PRINT ' Create tables ...' > CreateTables.sq l

cat ./Tables/dbo.table1.tab ./Tables/dbo.table2.tab
./Tables/dbo.table3.tab
CreateTables.sq l


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******** *******@TK2MSFT NGP15.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\M y Documents\SQL\D eploy

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

echo PRINT ' Create tables ...' > CreateTables.sq l

cat ./Tables/dbo.table1.tab ./Tables/dbo.table2.tab
./Tables/dbo.table3.tab
CreateTables.sq l


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+fil e3 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\M y Documents\SQL\D eploy

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

echo PRINT ' Create tables ...' > CreateTables.sq l

cat ./Tables/dbo.table1.tab ./Tables/dbo.table2.tab
./Tables/dbo.table3.tab
CreateTables.sq l


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
5124
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 with ActiveState Perl v5.6.1 Any help will be much appreciated. regards, Mike
5
23063
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 day to day, I need to be able to dynamically generate a batch file to concatenate these files. So far, I have looked at using FileSearch.FindFiles.Count to determine the number of files so that I can loop through the files that exist in a...
13
2386
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 and so forth to the 1st string. Any ideas how to go about this? Thanks,
14
2374
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
4013
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 are downloaded so that browser caching is out of the equation.) Thanks, Peter
2
13866
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) using csharp within a windows form application. One of the requirement also is to make sure the output file is closed only when the concatenation is done so that the next application using the file (printer spool) does not assume it is finished...
4
5054
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 matching records here is the cursor loop. I'm not a fan of cursors but also didn't see another way of achieving this. declare @ptr1 varbinary(16) declare @Ptr2 varbinary(16) declare @profileid int declare @x int
4
5891
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 files. The files will be created using an desktop xml editor, valid, etc. I want to find a way to create a master document using relevant portions of these multiple xml files which can then be converted into a usable format. The real situation...
1
2083
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. something like # a has 50 bytes, and b has 100 bytes f = FileList (open('a'), open('b')) f.read (100) # read 50 bytes from a and 50 from b
0
9566
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10555
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10300
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9127
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7607
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.