Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-22-2011, 01:41 PM   #1
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
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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
Registered: Jun 2007
Location: South Africa
Distribution: Linux Mint,Fedora, openSUSE, RHEL, SLES, Scientific Linux
Posts: 70

Rep: Reputation: 25
There are a few ways to do this.

cd /directory_where_files_are

find . -type f -exec cat {} >> my_combined_file.cap \;

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
Registered: Mar 2011
Location: Bellmawr, NJ
Distribution: Red Hat / Fedora
Posts: 195

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

Rep: Reputation: 1233Reputation: 1233Reputation: 1233Reputation: 1233Reputation: 1233Reputation: 1233Reputation: 1233Reputation: 1233Reputation: 1233
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
Registered: Jan 2011
Posts: 47

Original Poster
Rep: Reputation: 0
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
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


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 09:39 AM.

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