Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2004
    Posts
    135

    How to split and merge each file in SSH?

    What's the command to split and merge each file in SSH?
    My English is poor. Please tell me when I make a mistake so that I can improve.

  2. #2
    I'm not exactly sure what you're looking for but
    Code:
    split
    and cat
    can do the job

  3. #3
    Join Date
    Jun 2004
    Posts
    135
    Can you show me some example command?
    I have a file, "abc.tgz"
    How to split it and merge it afterthat?
    My English is poor. Please tell me when I make a mistake so that I can improve.

  4. #4
    Join Date
    Oct 2005
    Location
    .au
    Posts
    12
    If you have a file abc.tgz, try

    tar -zxvf abc.tgz

    to decompress it and extract the files (it is a gzipped tar archive). This should open up the archive and you should end up with a directory of files, say "dirname" with all your files under it. Depending on how the archive was made, all the files may just be extracted to the current directory

    When you have done what you want, you can recreate the archive with

    tar -cf abc.tar dirname

    where dirname is the name of the directory where all the files you want to archive reside. Finally you want to gzip it,

    gzip abc.tar

    You should now have abc.tar.gz, which you can rename to abc.tgz if you want or just leave it as a tar.gz.

  5. #5
    Join Date
    Sep 2005
    Location
    Essex, England
    Posts
    548
    If you have a 10MB file (abc.tgz)
    and you want to split it into 1MB chunks
    split -b 1048576 abc.tgz
    It will create 10 files xaa xab xac xad xae etc.
    To make one file at the other end
    cat xaa xab xac etc. > abc.tgz

    You could also do cat xa? > abc.tgz
    (? is the wildcard for one character only)

  6. #6
    Join Date
    Jun 2004
    Posts
    135
    Thanks guys!
    I will try it out
    My English is poor. Please tell me when I make a mistake so that I can improve.

  7. #7
    Join Date
    Apr 2003
    Location
    Atlanta, Jawja
    Posts
    3,074
    http://www.umiacs.umd.edu/~jusub/uni...s/19270095.htm covers what Blapto said, a bit more in depth though.
    Doug Hazard - "retired" Web Hosting Master
    * Full Stack (Web/WP) Dev for The Catholic Diocese of Richmond (160+ sites)
    * Sports Photographer, Media Personality and CFB Historian
    * Tech Admin for several Sports Networks/Sites

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •