LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Closed Thread
  Search this Thread
Old 10-21-2009, 03:28 PM   #1
Kunsheng
Member
 
Registered: Mar 2009
Posts: 82

Rep: Reputation: 16
Combine 10,000 small files into a single one


I got 10,000 small pieces text files inside a folder and thinking of comebine them together. (append them together)

'cat *' inside the folder failed and reminding me 'argument list too long'.

I know a perl scripts will do but wondering if there is better way (bash command ?)


Any idea is well appreciated,

-Kun
 
Old 10-21-2009, 03:46 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Duplicate post of:
http://www.linuxquestions.org/questi...ig-one-763441/
 
Old 10-22-2009, 12:43 AM   #3
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by Kunsheng View Post
I got 10,000 small pieces text files inside a folder and thinking of comebine them together. (append them together)

'cat *' inside the folder failed and reminding me 'argument list too long'.

I know a perl scripts will do but wondering if there is better way (bash command ?)


Any idea is well appreciated,

-Kun
The problem is that you have 10,000 files in a single folder. How did this happen? Have you considered this solution:

Code:
ls | while read path
do
    cat $path >> masterfile.txt
done
But avoid giving "ls" a wildcard argument -- just let it scan the directory on its own. And in the future, don't put so many files in one directory.
 
Old 10-22-2009, 02:35 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed 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

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine 10,000 small files into a big one Kunsheng Linux - Software 2 10-21-2009 09:16 AM
how to combine kernel and ramdisk to a single image file KitKat08 Linux - Distributions 1 02-09-2006 05:18 PM
Convert small dvd or cd files into to a single layer dvd? suse91pro General 0 09-27-2005 05:12 PM
Command to combine several files as a single file, etc. satimis *BSD 3 06-10-2004 03:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:39 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration