Every day my customer has a dozen text files (*.txt) that he needs to combine into one text file. Is there a way to combine them without having to copy and paste the text out of each one? File names are variable (and unpredictable). He’s using a product called UltraEdit, but I’m open to ideas. Thanks!
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Combine text files (XP/UltraEdit)
Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Combine text files (XP/UltraEdit)
- This topic has 4 replies, 3 voices, and was last updated 20 years, 2 months ago.
AuthorTopicWSsarahcarter
AskWoody LoungerMarch 17, 2005 at 8:29 pm #417233Viewing 1 reply threadAuthorReplies-
WSAndrew77
AskWoody LoungerMarch 17, 2005 at 9:10 pm #935513Hi Sarah,
What you’re looking for is something like the Unix “cat” command, which concatenates any number of files into a single one.
I’d suggest one of two options (there are certainly many more).
First, that’s a one-liner in Perl. Perl is available for free from http://www.activestate.com. With Perl installed, you could do this at the DOS command line:
> perl -ne "print" file1.txt file2.txt file3.txt > bigfile.txt
If you’re not interested in that approach, there are a few folks out there who have ported common Unix commands, like cat, to Windows. Check out: http://www.kilowattsoftware.com/PoofPage.htm%5B/url%5D. With cat installed, you could do this at the DOS command line:
> cat file1.txt file2.txt file3.txt > bigfile.txt
If it were my decision, I’d create a Perl script (just a text file) named “cat.pl”, consisting of the following:
while () {print};
And save that in C:Windows, so it’s always available, right from the command line, like this:
> cat file1.txt file2.txt file3.txt > bigfile.txt
In fact, I just did that, since it actually would be nice to have cat on my Windows machine.
Cheers!
-
WSsarahcarter
AskWoody Lounger -
WSAndrew77
AskWoody LoungerMarch 17, 2005 at 9:36 pm #935528Apparently you can also use the built-in DOS copy command:
> copy file1.txt file2.txt bigfile.txt
The name of the destination file comes last. See http://www.computerhope.com/copyhlp.htm#03%5B/url%5D.
It would be fairly simple to write a VBA macro to do this using the Shell command.
-
-
-
Ianm Dempster
AskWoody LoungerMarch 18, 2005 at 2:30 am #935576you’ve posted this in the Word forum I’m assuming that the end target is a Word file (albeit in text format)? In which case a wee VBA routine to create a new empty document followed by a loop to insert each of the .txt files from a chosen directory. Something along the lines of
Documents.Add
ChDir “C:txtfiles”
txtName = Dir(“*.txt”)
While txtName “”
With Selection
.InsertFile FileName:=txtName, ConfirmConversions:=False
.InsertParagraphAfter
.Collapse Direction:=wdCollapseEnd
End With
txtName = Dir()
WendAt the end of this the Word doc contains the contents of the .txt files in the order that the Dir function serves them up – which raises the question of whether they need to be combined in a particular order?
If it is inconvenient to use a fixed directory name then you can always use the FileDialog object to allow navigating to a directory of choice and then selection of the .txt files to deal with – if order was a problem then presumably the dialog could be called repeatedly to choose one file at a time (slow but probably the only way to deal with unpredictable file names if there is a particular order of concatenation required)
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
1 hour, 55 minutes ago -
89 million Steam account details just got leaked,
by
Alex5723
10 hours, 20 minutes ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
10 hours, 28 minutes ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
1 hour, 27 minutes ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
3 hours, 50 minutes ago -
Installer program can’t read my registry
by
Peobody
3 hours, 26 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
23 hours, 58 minutes ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
6 hours, 34 minutes ago -
False error message from eMClient
by
WSSebastian42
21 hours, 36 minutes ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
1 day, 6 hours ago -
Office 2021 Perpetual for Mac
by
rebop2020
1 day, 7 hours ago -
AutoSave is for Microsoft, not for you
by
Will Fastie
4 hours, 29 minutes ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
1 day, 11 hours ago -
Seven things we learned from WhatsApp vs. NSO Group spyware lawsuit
by
Alex5723
12 hours, 27 minutes ago -
Outdated Laptop
by
jdamkeene
1 day, 16 hours ago -
Updating Keepass2Android
by
CBFPD-Chief115
1 day, 22 hours ago -
Another big Microsoft layoff
by
Charlie
1 day, 21 hours ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
1 day, 1 hour ago -
May 2025 updates are out
by
Susan Bradley
18 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
2 days, 3 hours ago -
Windows 11 Insider Preview build 26120.3964 (24H2) released to BETA
by
joep517
2 days, 4 hours ago -
Drivers suggested via Windows Update
by
Tex265
2 days, 3 hours ago -
Thunderbird release notes for 128 esr have disappeared
by
EricB
2 days, 1 hour ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
2 days, 10 hours ago -
Apple releases 18.5
by
Susan Bradley
2 days, 5 hours ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
2 days, 12 hours ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
2 days, 12 hours ago -
Windows 7 ISO /Windows 10 ISO
by
ECWS
21 hours, 19 minutes ago -
No HP software folders
by
fpefpe
2 days, 20 hours ago -
Which antivirus apps and VPNs are the most secure in 2025?
by
B. Livingston
1 day, 17 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.