Split files

How I can split files in chunks, fast ? truncate() is fast but
unfortunately the initial file disappeared after the first loop ...
George Bouras [ Di, 18 April 2006 19:54 ] [ ID #1279135 ]

Re: Split files

In article <1145347032.263745 [at] athnrd02>, George Bouras
<athens-pm [at] pm.org> wrote:

> How I can split files in chunks, fast ? truncate() is fast but
> unfortunately the initial file disappeared after the first loop ...

truncate will delete the rest of the file. To split a file in chunks:

1. open file for reading
2. read a chunk
3. write the chunk out to another file
4. repeat 2 and 3 until done.
Jim Gibson [ Di, 18 April 2006 19:05 ] [ ID #1279137 ]

Re: Split files

"George Bouras" <athens-pm [at] pm.org> wrote in message
news:1145347032.263745 [at] athnrd02...
> How I can split files in chunks, fast ? truncate() is fast but
> unfortunately the initial file disappeared after the first loop ...

You could always use the 'split' command.
Tintin [ Fr, 21 April 2006 11:50 ] [ ID #1283825 ]
Perl » alt.perl » Split files

Vorheriges Thema: Inverted syntax for an if conditional
Nächstes Thema: Script works locally, but fails remotely.