Something like Split And Concat.

Discussion in 'Mac Apps and Mac App Store' started by Wadget, Jun 24, 2006.

  1. Wadget macrumors member

    Joined:
    Jan 16, 2006
    #1
    Hey,

    I'm looking for a program that can split and join, more importantly join, files like Split & Concat that will run on OS 9.2

    Is there anything like that available?
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Well there is the Unix split command. That deals with the splitting side. I think you can then just cat >> to append the files back together again.
     
  3. Wadget thread starter macrumors member

    Joined:
    Jan 16, 2006
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Here is an example (I've just tried it with a real file to confirm it works).

    To split the file (in my case called Test.JPG) open the Terminal, cd to the correct folder and type:

    Code:
    split -b100k Test.JPG
    
    This creates a load of 100k files that are the jpeg split up (the last file is less than 100k.

    To put the fragments back together again:

    Code:
    cat xaa > test1.jpg
    cat xab >> test1.jpg
    cat xac >> test1.jpg
    cat xad >> test1.jpg
    ...
    
    Repeat all the cats until you run out of files. I suspect there is probably a better way of doing the second step involving some shell scripting. Or you could write a cute GUI for this!

    If you want to control the name of the split files a bit better you can do something like:

    Code:
    split -b100k Test.JPG split_Test_
    
    which will produce files split_Test_aa, split_Test_bb etc.
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    OK. Here's a better way to do the concat stage. If we assume that our input files are called split_test_aa, split_test_bb etc and we want a file called test2.jpg then:

    Code:
    ls -1 split_test_* | xargs -I fname cat fname >> test2.jpg
    
    will put all the files back together again.

    Unix is cool huh?
     
  6. Wadget thread starter macrumors member

    Joined:
    Jan 16, 2006
    #6
    When you say "cd to the correct folder"

    How do you cd it to a specific folder?
     
  7. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #7
    When you first start the Terminal your current working directory will be ~ (your home folder /Users/<username> normally). You use cd <foldername> to change to a folder within the current folder. cd .. takes you up one level. You can combine cds together with / so cd Desktop/test would take to you a folder called test on your Desktop if you start in your home folder.

    You can list the contents of your current folder via ls. The standard output does not help you tell which are folders. ls -l gives you more details. If the block of letters at the start of the line starts with a d then it's a directory (folder).
     
  8. Wadget thread starter macrumors member

    Joined:
    Jan 16, 2006
    #9
  9. reh macrumors 6502a

    Joined:
    Oct 24, 2003
    Location:
    Arkansas
    #10
    Oh, oops! Sorry 'bout that. :)
     

Share This Page