Jed’s fridge door notes (a.k.a. “so i won’t forget”)

classic jazz, unix one-liners, anti-theism, crypto

Why you don’t need HJSplit for Linux

with 17 comments

HJSplit is famous in the DOS/Windows world as a way to split/join large files for easy network transfer. I’m just confused why they bothered to make an HJSplit version for linux. This HJSplit for Linux even requires you to install a separate library which add to the garbage for such a useless app (for nix). If you’re on linux and you encounter a file split via HJSplit, just use the venerable `cat` and you’d be fine.

cat split-files.rar.* > split-files.rar

Written by jedrm

June 27, 2007 at 12:49 pm

Posted in Unix One-Liners

Tagged with , , , ,

17 Responses

Subscribe to comments with RSS.

  1. Thanks for the tip!

    Sam

    September 21, 2007 at 8:00 pm

  2. the best tip I’ve got

    Ofer

    October 4, 2007 at 10:07 pm

  3. Didn’t know this – thanks for pointing it out :-)

    Arc

    May 8, 2008 at 11:17 pm

  4. Now I’m just wondering how to easily split the file in linux so something like HJsplit in windows can join it together again.

    Messing about with the split command but the closest I’ve gotten is to have the files output starting at .000, instead of .001

    Arc

    May 9, 2008 at 5:37 pm

  5. Arc:

    $ i=1;for file in splitfiles*; do mv $file $(printf “newfiles.%03i” $i);i=$((i+1)) ; done

    Didn’t bother re-using the old filename because it would just clobber the next file name if I do it like

    file.000 –> file.001 # will write over the original file.001

    so making a new filename is the best I can come up with in 5 minutes :)

    jedrm

    May 17, 2008 at 10:28 am

  6. Cant get any easier. Cheers for this!

    Brinley

    August 17, 2008 at 3:52 pm

  7. Nifty! I used it and it works fine. Thanks :D

    Clair

    September 11, 2008 at 2:16 pm

  8. [...] to the blog post of Jed about why you don’t need HJSplit for Linux. I’ve never really had the need to split files nor join files until [...]

  9. @Clair: Glad to help :)

    jedrm

    September 13, 2008 at 1:04 am

  10. Can’t belive that there is no cat equivalent in Windows… Cant this be done in DOS?

    Rishabh

    September 14, 2008 at 9:29 pm

  11. You have the choice of installing cygwin.com. But why install cygwin when you can install hjsplit for windows.

    This is just for linux users who don’t want to install hjsplit for linux on their machines.

    You can try the “type” command in the command propt but I’m not sure if that will work.

    We’d like to hear if you are successful.

    jedrm

    September 16, 2008 at 3:36 pm

  12. One of the best tips I have come across. THANK YOU!

    Chuck

    October 19, 2008 at 12:20 am

  13. Claps your hands and say yeahhh. Great tips.

    Dimas

    January 13, 2009 at 8:17 am

  14. great tip. i rate this as one from a “guru”. thanks. but i can not figure out the script that would split the file. where are we specifying the number of parts we would like to split the file into ?

    aman gopal sureka

    January 14, 2009 at 2:02 pm

  15. @aman: that’s easy. to split the file use bash’s split command.

    split -da 3 bigfile.pdf splitfiles

    (‘man split’ for more info on the useful split command)

    the command:

    i=1;for file in splitfiles*; do mv $file $(printf “newfiles.%03i” $i);i=$((i+1)) ; done

    is just used to rename the files so the first splitfile has .001 has its extension instead of .000 which is the default for the split command.

    Because HJSplit only detect files starting with .*1 as its first file (which is weird in computerland where everything should start with 0).

    I guess you can make a better version using Perl/Python/Ruby/etc that will split files into HJSPlit named formats but I’m lazy so the above will work anytime, everytime without you breaking a sweat.

    jedrm

    January 15, 2009 at 3:31 pm

  16. thanks a million. i honestly feel “enlightened” :) this is a really neat feature that i can use. i was not aware of the split command and the script makes sense (to me) now.

    aman gopal sureka

    January 15, 2009 at 4:51 pm

  17. I figured the files were just literally split and renamed, just shows how stupid people are that try to make you download this closed source HJSplit crap probably full of virii. Shh, don’t show them this page or they will insert headers and obfuscation in the split files!

    dooh

    July 5, 2009 at 5:17 am


Leave a Reply