LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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

Reply
 
Search this Thread
Old 03-22-2011, 01:41 PM   #1
dirtydog7655
Member
 
Registered: Jan 2011
Posts: 47

Rep: Reputation: 0
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.
 
Old 03-22-2011, 01:46 PM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
You could simply display them all at once with "cat", and pipe the result into a new file.
 
Old 03-22-2011, 01:47 PM   #3
rgdacosta
Member
 
Registered: Jun 2007
Location: South Africa
Distribution: Linux Mint,Fedora, openSUSE, RHEL, SLES, Scientific Linux
Posts: 70

Rep: Reputation: 24
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
 
Old 03-22-2011, 01:52 PM   #4
savona
Member
 
Registered: Mar 2011
Location: Bellmawr, NJ
Distribution: Red Hat / Fedora
Posts: 194

Rep: Reputation: 50
cd /directory_where_files_are
cat *.cap >> onefile.cap
 
Old 03-22-2011, 02:17 PM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,152
Blog Entries: 1

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
Quote:
Originally Posted by savona View Post
cd /directory_where_files_are
cat *.cap >> onefile.cap
but remember, this may not be in sorted order.
 
Old 03-22-2011, 07:37 PM   #6
dirtydog7655
Member
 
Registered: Jan 2011
Posts: 47

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by szboardstretcher View Post
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

?
 
Old 05-16-2013, 10:47 PM   #7
joebloggs99
LQ Newbie
 
Registered: May 2013
Posts: 2

Rep: Reputation: Disabled
If it is just a one off, you could use an online converter such as merge-files-online.com
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Splitting text file into multiple files Mithrilhall Programming 5 12-10-2010 10:32 AM
[SOLVED] Combine 3 text files into 1 W_Bosman Linux - Newbie 7 09-01-2010 05:28 PM
combine text files with a regex itzfritz Linux - General 10 06-18-2009 01:26 PM
Combine multiple one column text file into one text file with multiple colum khairilthegreat Linux - Newbie 7 11-23-2007 01:31 PM
Steps needed to convert multiple text files into one master text file jamtech Programming 5 10-07-2007 11:24 PM


All times are GMT -5. The time now is 05:15 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration