|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have 30 text files on UNIX that I need to concatenate and create one big file. Could anyone provide me with a solution (if one exist)? I need the answer asap (today). Thanks a lot. Denis |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Hi
you can use: cat file1 file2 file3...... fileN > added file. example file1 Hello file2 Goodbye cat file1 file2 > fileresult fileresult Hello Goodbye |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Seeing as you have a lot of files it'd be quick to do something like
$ cd /path/to/files $ files=* $ cat $files > bigfile Saves you typing all the filenames in. There are more ways to do this, but this is about the quickest and easiest. Cheers ZB |
|
#4
|
|||
|
|||
|
Good suggestion ZB. But there is no other way than typing all the filenames if one needs to concatenate files in a specific order.
|
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Quote:
![]() I also have a wee suspicion that this whole thing is a homework post anyway "I need the answer asap (today)" - hmmm Cheers ZB |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
zazzybob!
Your answer (found via Google search) is a great help to me, thanks. $ cd /path/to/files $ files=* $ cat $files > bigfile I modified it like that: $ cd /path/to/files $ files=*.txt $ cat $files > bigfile.txt How could I insert in front of the content of each file some special string, like many dashes, and / or the given file's name? So, the bigfile.txt looked like this: ********* file1.txt content of file1 ********* file2.txt content of file2 ********* file3.txt content of file3 ... ... etc Thanks a lot, Tamas (I use Kubuntu, by the way) |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Concatenating two files | Sriramprabu | Shell Programming and Scripting | 6 | 09-15-2008 11:33 PM |
| negatively concatenating files | raidzero | Shell Programming and Scripting | 2 | 07-10-2008 03:52 PM |
| Concatenating records from 2 files | Powcmptr | UNIX for Dummies Questions & Answers | 4 | 04-02-2008 03:57 PM |
| concatenating x files into a one... | Nicol | UNIX for Dummies Questions & Answers | 1 | 09-30-2004 08:13 AM |
|
|