Concatenate Numerous Files


 
Thread Tools Search this Thread
Operating Systems Linux Fedora Concatenate Numerous Files
# 22  
Old 11-01-2012
Quote:
Originally Posted by sudon't
Code:
find /there/too -type f -name "*txt" -exec cmd {} \;

Oh, could we have just used this with cat in the first place? It's kinda like how I did it in the end, isn't it?
Yes and no: yes, in principle you could have done that. But you said you wanted to sort the files first, which is why i came up with the idea of the intermediate file, in which you could have sorted.

Still, alisters idea of guessing the filenames from a pattern was way better than mine, because it required a lot less handwork and still lead to the same result. Why it didn't work for you is still a mystery for me, i tried his solution with a dummy fileset and it worked well under Ubuntu 10, Fedora 13 and AIX 5.3. I have no MacOS to try it there, though, but from what i know this should make no difference.

Quote:
I learned what the gods really appreciate, from Homer.
Well said! I did the same, threw in some Epicurus for good measure and it didn't make me exactly unhappy.

I enjoyed the thread tremenduously, so thanks for asking questions and staying interested to the end. Whenever you want something to know we will be here to help again.

I hope this helps.

bakunin
# 23  
Old 11-01-2012
Quote:
Why it didn't work for you is still a mystery for me.
I think it had to do with the whitespaces in the directories and filenames. Since that has been fixed, when I get a chance, I will give Alister's script, (and maybe the other's as well), another go. I will let you all know the results.
I also want to mention how incredibly useful find has turned out to be. Thanks for that one!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Concatenate files and delete source files. Also have to add a comment.

- Concatenate files and delete source files. Also have to add a comment. - I need to concatenate 3 files which have the same characters in the beginning and have to remove those files and add a comment and the end. Example: cat REJ_FILE_ABC.txt REJ_FILE_XYZ.txt REJ_FILE_PQR.txt >... (0 Replies)
Discussion started by: eskay
0 Replies

2. UNIX for Dummies Questions & Answers

Concatenate files

Hi I am trying to learn linux step by step an i am wondering can i use cat command for concatenate files but i want to place context of file1 to a specific position in file2 place of file 2 and not at the end as it dose on default? Thank you. (3 Replies)
Discussion started by: iliya24
3 Replies

3. UNIX for Dummies Questions & Answers

Concatenate Several Files to One

Hi All, Need your help. I will need to concatenate around 100 files but each end of the file I will need to insert my name DIRT1228 on each of the file and before the next file is added and arrived with just one file for all the 100files. Appreciate your time. Dirt (6 Replies)
Discussion started by: dirt1228
6 Replies

4. Shell Programming and Scripting

Concatenate files

I have a file named "file1" which has the following data 10000 20000 30000 And I have a file named "file2" which has the following data ABC DEF XYZ My output should be 10000ABC 20000DEF (3 Replies)
Discussion started by: bobby1015
3 Replies

5. Shell Programming and Scripting

Concatenate files

Hi, I want to create a batch(bash) file to combine 23 files together. These files have the same extension. I want the final file is save to a given folder. Once it is done it will delete the 23 files. Thanks for help. Need script. (6 Replies)
Discussion started by: zhshqzyc
6 Replies

6. Shell Programming and Scripting

Concatenate files

I have directory structure sales_only under which i have multiple directories for each dealer example: ../../../Sales_Only/xxx_Dealer ../../../Sales_Only/yyy_Dealer ../../../Sales_Only/zzz_Dealer Every day i have one file produce under each directory when the process runs. The requirement... (3 Replies)
Discussion started by: mohanmuthu
3 Replies

7. Shell Programming and Scripting

Concatenate rows in to 2 files

I have 2 files FILEA 1232342 1232342 2344767 4576823 2325642 FILEB 3472328 2347248 1237123 1232344 8787890 I want the output to go into a 3rd file and look like: FILEC 1232342 3472328 (1 Reply)
Discussion started by: unxusr123
1 Replies

8. Shell Programming and Scripting

Script to concatenate several files

I need a script to concatenate several files in one step, I have 3 header files say file.S, file.X and file.R, I need to concatenate these 3 header files to data files, say file1.S, file1.R, file1.X so that the header file "file.S" will be concatenated to all data files with .S extentions and so on... (3 Replies)
Discussion started by: docaia
3 Replies

9. UNIX for Dummies Questions & Answers

How to concatenate all files.

Hi, I'm totally new to Unix. I'm an MVS mainframer but ran into a situation where a Unix server I have available will help me. I want to be able to remotely connect to another server using FTP, login and MGET all files from it's root or home directory, logout, then login as a different user and do... (1 Reply)
Discussion started by: s80bob
1 Replies

10. UNIX for Dummies Questions & Answers

Deleting numerous files

Hi there, I have numerous files in a directory (approx 2500) that I want to delete although I get the following:- Server> rm *.* Arguments too long Is there a proper way of deleting this rather than breaking it down further through the list of files rm *10.* rm *11.* rm *12.* ... (10 Replies)
Discussion started by: Hayez
10 Replies
Login or Register to Ask a Question