Help with cat long list of file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with cat long list of file
# 1  
Old 08-25-2011
Help with cat long list of file

I have long list of input file's content that I plan to "cat" all of the content into another output file.
The total input file is around 20,000 which all named with ".txt"
Below is the command that I try:
Code:
cat *.txt > all_file.out
-bash: /usr/bin/sudo: Cannot allocate memory

Unfortunately, it shown the above error message.
can I know how to solve it out?
Many thanks for advice.
# 2  
Old 08-25-2011
Code:
 
for filename in *.txt
do
    cat $filename >> all_file.out
done

This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 08-25-2011
Code:
echo *.txt | xargs cat >OUTPUTFILE

or (if filenames contain spaces):
Code:
find . -name '*.txt' | xargs cat

This User Gave Thanks to yazu For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Long list file display different time format.

Hi Gurus, I have some weird issue. when using ls -l the result shows different time format: -rw-r--r-- 1 abc gourp1 3032605576 Jun 14 2013 abc -rw-rw-r-- 1 abc gourp1 1689948832 Aug 10 06:22 abc one display 2013 which is year; another one displays 06:22 which is time. ... (4 Replies)
Discussion started by: ken6503
4 Replies

2. Shell Programming and Scripting

mv : Argument list too long

Hi I am using find command -- find "directory1" -type f | xargs -i mv {} "directory2" to avoid above argument list too long problem. But, issue i am facing is directory1 is having subdirectories due to this i am facing directory traversal problem as i dont want to traverse subdirectories... (9 Replies)
Discussion started by: VSom007
9 Replies

3. UNIX for Dummies Questions & Answers

Arg list too long

Hello All, I am trying to find a file name with .sh exention from a list of .dat files inside a directory. find /app/folder1/* -name '*.dat'| xargs grep '.sh' ksh: /usr/local/bin/find: arg list too long Please help me finding the command. Thanks (3 Replies)
Discussion started by: tkhan9
3 Replies

4. Shell Programming and Scripting

Argument list too long!!

Dear Experts, I have a list of 10K files in a directory. I am not able to execute any commands lile ls -lrt, awk, sed, mv, etc........ I wanna execute below command and get the output. How can I achieve it?? Pls help. root# awk -F'|' '$1 == 1' file_20120710* | wc -l /bin/awk: Argument list... (2 Replies)
Discussion started by: Naga06
2 Replies

5. UNIX for Dummies Questions & Answers

cat a list of directory paths only to a file

Hi! I would like to funnel a series of directories and subdirectories into a text file. This is the output I would like to see from a find command: /mypath/ABC_01/VISIT_01 /mypath/ABC_01/VISIT_02 /mypath/ABC_01/VISIT_03 /mypath/ABC_02/VISIT_01 /mypath/ABC_03/VISIT_01 I've tried: find... (2 Replies)
Discussion started by: goodbenito
2 Replies

6. Shell Programming and Scripting

Numerically sort problem for a long list of file name

I got a long list of file name. My input: data_1.txt data_2.txt data_3.txt data_10.txt data_21.txt data_12.txt data_4.txt My desired output: data_1.txt data_2.txt data_3.txt data_4.txt data_10.txt data_12.txt data_21.txt Does anybody got idea how to archive it? (11 Replies)
Discussion started by: patrick87
11 Replies

7. Shell Programming and Scripting

Help with find command and list in a long format each found file

The purpose of those comands are to find the newest file in a directory acvrdind to system date, and it has to be recursively found in each directory. The problem is that i want to list in a long format every found file, but the commands i use produce unexpected results ,so the output lists in a... (5 Replies)
Discussion started by: alexcol
5 Replies

8. UNIX for Dummies Questions & Answers

ls -t arg list too long

echo dirname/filename* | xargs ls -t As a substitute doesn't give the results desired when I exceed the buffer size. I still want the files listed in chronological order, unfortunately xargs releases the names piecemeal...does anyone have any ideas? :( (4 Replies)
Discussion started by: CSU_Ram
4 Replies

9. HP-UX

parameter list too long

Hi When i say ls * (HP-UX 11.11)in a particular directory it says sh: /usr/bin/ls: The parameter list is too long. Can somebody help me how to resolve this problem. (2 Replies)
Discussion started by: satyanarayang
2 Replies

10. Shell Programming and Scripting

Parameter List to Long

I am trying to do a find file command on a directory and delete files older then 30 days and I am getting an error saying that the parameter list that I am passing to the rm command is to long. Here is my command: find ~mydir/* -type f -mtime +$30 | xargs -i -exec rm -rf {} \; ksh:... (3 Replies)
Discussion started by: lesstjm
3 Replies
Login or Register to Ask a Question