Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-22-2011, 01:41 PM
|
#1
|
|
Member
Registered: Jan 2011
Posts: 47
Rep:
|
Combine multiple text files into one text file?
Thanks for the help, got it!
Last edited by dirtydog7655; 03-23-2011 at 10:51 AM.
|
|
|
|
03-22-2011, 01:46 PM
|
#2
|
|
Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,817
|
You could simply display them all at once with "cat", and pipe the result into a new file.
|
|
|
|
03-22-2011, 01:47 PM
|
#3
|
|
Member
Registered: Jun 2007
Location: South Africa
Distribution: Fedora, openSUSE, RHEL, SLES
Posts: 53
Rep:
|
There are a few ways to do this.
Code:
cd /directory_where_files_are
find . -type f -exec cat {} >> my_combined_file.cap \;
or
Code:
cd /directory_where_files_are
for $i in $(find . -type f); do cat $i >> my_combined_file.cap; done
|
|
|
|
03-22-2011, 01:52 PM
|
#4
|
|
Member
Registered: Mar 2011
Location: Bellmawr, NJ
Distribution: Red Hat / Fedora
Posts: 194
Rep:
|
cd /directory_where_files_are
cat *.cap >> onefile.cap
|
|
|
|
03-22-2011, 02:17 PM
|
#5
|
|
Senior Member
Registered: Aug 2006
Location: C:\MSDOS\
Distribution: LFS 3.8.11 with OpenBox 3.5.0
Posts: 1,455
|
Quote:
Originally Posted by savona
cd /directory_where_files_are
cat *.cap >> onefile.cap
|
but remember, this may not be in sorted order.
|
|
|
|
03-22-2011, 07:37 PM
|
#6
|
|
Member
Registered: Jan 2011
Posts: 47
Original Poster
Rep:
|
Quote:
Originally Posted by szboardstretcher
but remember, this may not be in sorted order.
|
In place of the asterisk, simply place the file name?
Such as cat log.cap1 log.cap2 >> finallog.cap
?
|
|
|
|
05-16-2013, 10:47 PM
|
#7
|
|
LQ Newbie
Registered: May 2013
Posts: 2
Rep: 
|
If it is just a one off, you could use an online converter such as merge-files-online.com
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:46 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|