LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How can I split a file, without using 'split'? (https://www.linuxquestions.org/questions/linux-software-2/how-can-i-split-a-file-without-using-split-881844/)

szboardstretcher 05-20-2011 12:46 PM

How can I split a file, without using 'split'?
 
Im in a unique situation where a box has a 400G file, on FreeBSD, without the 'split' utility available.

How can I split this file into 25G chunks?

corp769 05-20-2011 12:56 PM

Hello,

Have you thought about using dd? Maybe something like the following?
Code:

dd if=/home/user/largefile of=/home/user/splitfile1 bs=1M count=1000
That would be equivalent to about a gigabyte of data. Of course you can modify that to suit your needs.

Cheers,

Josh

corp769 05-20-2011 12:59 PM

To add to that past though, you would then need to use "skip=XXX" to skip the first XXX blocks of data so you can split the rest of the file without using the first split section. For the reference, here is the man page - http://linux.die.net/man/1/dd

Cheers,

Josh

szboardstretcher 05-20-2011 01:01 PM

Wouldnt that just copy the first 1Gb of the file to another file?

How would you split the 400G file into 2 perfect pieces? Something like, dd (1 to 200G) > file1, dd (200 to 400G) > file2?

---------- Post added 05-20-11 at 02:02 PM ----------

Quote:

Originally Posted by corp769 (Post 4362138)
To add to that past though, you would then need to use "skip=XXX" to skip the first XXX blocks of data so you can split the rest of the file without using the first split section. For the reference, here is the man page - http://linux.die.net/man/1/dd

Cheers,

Josh

Ah. I see now.

Any other suggestions aside from dd? Because oddly enough, that program isn't on there either. :(

Maybe cut? cat? Im grasping for straws here.

corp769 05-20-2011 01:07 PM

Ouch, damn dude. Can't you just download the utilities and compile them for the system?

szboardstretcher 05-20-2011 01:12 PM

Its a "FreeNas" box and has exactly "Crap" on it for utilities, compilers, etc... They cripple it pretty good.

I could copy the file off and split it on a real OS with split, but the copy time is prohibitive for me. Im reaching out and hoping that someone can pull out that magic "Oh yeah, you can use a combination of echo, cat and ls" idea.

corp769 05-20-2011 01:20 PM

Hmm... Came across this: http://paulbradley.tv/44/
But the question is, do you have access to the tar command? I really hope so..... LOL

michaelk 05-20-2011 01:21 PM

tar might be another option.

Not quick enough...

corp769 05-20-2011 01:22 PM

Quote:

Originally Posted by michaelk (Post 4362162)
tar might be another option.

Not quick enough...

Nope, you're not :p

szboardstretcher 05-20-2011 01:22 PM

Quote:

Originally Posted by corp769 (Post 4362161)
Hmm... Came across this: http://paulbradley.tv/44/
But the question is, do you have access to the tar command? I really hope so..... LOL

Yes, it has tar :P

This will work, thanks Corp

corp769 05-20-2011 01:23 PM

No problem dude!

Cheers,

Josh

teckk 05-20-2011 02:43 PM

Code:

locate split | grep ports | less
.......
/usr/ports/sysutils/lxsplit
/usr/ports/sysutils/lxsplit/Makefile
/usr/ports/sysutils/lxsplit/distinfo
/usr/ports/sysutils/lxsplit/files
/usr/ports/sysutils/lxsplit/files/patch-Makefile
/usr/ports/sysutils/lxsplit/pkg-descr

Code:

cat /usr/ports/sysutils/lxsplit/pkg-descr
This utility is used to split up huge files into smaller pieces without
compression. It is fully compatible with HJSplit. HJSplit is a program
written by Freebyte!. See http://www.freebyte.com for more information
about HJSplit.

WWW: http://lxsplit.sourceforge.net/



All times are GMT -5. The time now is 09:20 PM.