|
#1
| ||||
| ||||
| I have thousands (no joke) of text files I need concatenated into a single file. They are all separated into hundreds of little sub-folders, and some in 2-3 levels deeper. The folder names and file names are all alphabetically sorted. Is there any analogy to rm -r {directory_name} for cat {directory_name} > output_file_name. Alternatyively is there a PERL or shell script I can eaisly write (assuming I know zero perl BTW) that could recursively put all the folders and files into one folder? Alternatively I was looking at either TAR or GUNZIP flags that will prevent the archive's folder structure from being preserved on decompression. Theoretically I could compress this all and then decompress it so the paths are not preserved so all the files spilled back into one folder? I can't find the flag thouugh, don't know if it exists. Anyway, any ideas?
__________________ //Gwailo// iMac TFT 700MHz G4, 786 RAM, 40GB Internal DVD-ROM/CD-RW 12x8x32 USB 64MB Flash Drive Wacom Graphire2 Tablet Epson 777i Colour Printer Canon PowerShot S30 Digital Camera JVC GR-DVF21 NTSC MiniDV Camera Canon EOS Elan II (35mm) "Like a beautiful flower full of colour and also fragrant, even so, fruitful are the fair words of one who practices them." --54th Surtra, The Dhammapada |
|
#2
| ||||
| ||||
| One way of doing it would be (fingers crossed that bbscript doesn't eat this): find . -type f -exec cat {} >> ../a_big_file ";" This will find all regular files in the current directory and all subdirectories, and concatenate them into a file called a_big_file, which will be in the parent directory. You can put your big file anywhere you want, but don't put it in or below the current directory - then "find" will find the file, and concatenate it onto itself again and again and again, which you likely don't want...
__________________ What is the robbing of a bank compared to the founding of a bank? -- Bertold Brecht |
|
#3
| ||||
| ||||
| Oh yeah!!! That was perfect! I tried it and it seems to have worked perfectly (I'm not even in the same city as my computer today, so using only the terminal to view my MASSIVE text file) but it seems good! Thanks scruffy! ![]()
__________________ //Gwailo// iMac TFT 700MHz G4, 786 RAM, 40GB Internal DVD-ROM/CD-RW 12x8x32 USB 64MB Flash Drive Wacom Graphire2 Tablet Epson 777i Colour Printer Canon PowerShot S30 Digital Camera JVC GR-DVF21 NTSC MiniDV Camera Canon EOS Elan II (35mm) "Like a beautiful flower full of colour and also fragrant, even so, fruitful are the fair words of one who practices them." --54th Surtra, The Dhammapada |
![]() |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| moving my itunes files to another location | Numbers1820 | Mac OS X System & Mac Software | 2 | December 20th, 2002 10:02 PM |
| Recursively delete files of one name in subfolders? | michaelsanford | Unix & X11 | 4 | November 20th, 2002 08:48 AM |
| Native FTP program? | bighairydog | Apple News, Rumors & Discussion | 17 | November 30th, 2001 02:31 PM |
| Solution: OS X creating "." files on Samba shares | dricci | Apple News, Rumors & Discussion | 0 | November 21st, 2001 11:23 PM |