LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-20-2011, 12:46 PM   #1
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-20-2011, 12:56 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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
 
1 members found this post helpful.
Old 05-20-2011, 12:59 PM   #3
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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
 
2 members found this post helpful.
Old 05-20-2011, 01:01 PM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Original Poster
Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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 View Post
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.

Last edited by szboardstretcher; 05-20-2011 at 01:03 PM.
 
Old 05-20-2011, 01:07 PM   #5
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Ouch, damn dude. Can't you just download the utilities and compile them for the system?
 
1 members found this post helpful.
Old 05-20-2011, 01:12 PM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Original Poster
Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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.
 
1 members found this post helpful.
Old 05-20-2011, 01:20 PM   #7
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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
 
1 members found this post helpful.
Old 05-20-2011, 01:21 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
tar might be another option.

Not quick enough...
 
Old 05-20-2011, 01:22 PM   #9
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by michaelk View Post
tar might be another option.

Not quick enough...
Nope, you're not
 
Old 05-20-2011, 01:22 PM   #10
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Original Poster
Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by corp769 View Post
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
 
Old 05-20-2011, 01:23 PM   #11
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
No problem dude!

Cheers,

Josh
 
1 members found this post helpful.
Old 05-20-2011, 02:43 PM   #12
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
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/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
package management (to split or not to split packages) frischi Linux - Desktop 2 05-06-2010 03:15 PM
Split file in two imkornhulio Programming 4 03-18-2009 11:21 AM
split file wolfipa Programming 3 12-11-2007 05:18 AM
How to split file , .. awk or split ERBRMN Linux - General 9 08-15-2006 12:02 AM
split file farkmischer Linux - Laptop and Netbook 3 11-28-2004 07:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration