> Hello there,
> 
> I have a question about how i can split files.
> 
> Let's say i have some very large files. (2gb for example)
> and i want to split them into 650mb files. (they are plaintekst only)
>

Depending on the size of the files you may need a Perl enabled with
"large file support".... perl -V should tell you if your Perl is setup
to use them.
 
> I was thinking about something in the lines of this; (just words)
> 
> set size arguments
> set input file
> set output file
> 
> open the file
> read the content
> print line of the content to $output file
> check size of $output file
> continue if not to big yet
> else
> check which files already live in the target directory (.1 .2 .3 .4 .5
etc)
> rotate file to $output file.1 (or .2 .3)
> and restart the printing process
> 
> 
> 
> Is something like this possible (or perhaps easier or something?)
> 
> Thanks in advance!!
> 

Sounds like a well thought out plan, and is definitely doable. Add a few
punctuation marks, a call to 'stat' (or maintain an internal counter of
the amount written so far) and you are almost done ;-).

If your intention is just to reassemble them later there are other
programs that are pre-written that might be more appropriate, and/or man dd.

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to