#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Posts
    5
    Rep Power
    0

    how to combine files


    hello im new to hear and found this site by chance.

    I was wondering if anyone can help me.

    I would like to write a shell script that can combine files together. It doesnt have to compress them just combine....

    Can anyone suggest any good web sites and what tools i should use

    Thanks

    Simpson
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,648
    Rep Power
    4248
    You can use the cat command to concatenate files.
    E.g.
    cat filename1 filename2 filename3 > finalfile
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Posts
    5
    Rep Power
    0
    I thought about catting the files in but how would i get them back into 2 seperate files.

    Thanks for the reply

    Simpson
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,648
    Rep Power
    4248
    Ah, then maybe you could use the tar command. Typically, a tar command to archive a bunch of files would look something like this:

    tar -cvf finalfile.tar filename1 filename2 filename3 ...
    or
    tar -zcvf finalfile.tar.gz filename1 filename2 filename3 .... (if you want the tar file to be gzipped as well)

    Then, to extract, you would type something like this:

    tar -xvf finalfile.tar
    or
    tar -zxvf finalfile.tar.gz

    I'd suggest you read the man pages for the tar command first, to determine what the various options are, before trying it out.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Posts
    5
    Rep Power
    0
    thanks for that i have heard of the tar command. ill take a look at the man pages.

    Thanks again

IMN logo majestic logo threadwatch logo seochat tools logo