On Sep 24, 2007, at 7:07 AM, Walter Ian Kaye wrote:


At 07:51 a -0400 09/23/2007, Greg V. Raven didst inscribe upon an electronic papyrus:

Check out iPod ebook creator:

http://www.ambience.sk/ipod-ebook-creator/ipod-book-notes-text- conversion.php

Interesting webapp, though doesn't address this:

It would be nicer still if the parts were named mylist_A-B.txt, mylist_C-... with some hint in the file name as to which entries, alphabetically, were contained therein. Since it's an alphabetical listing, the first character on each line tells us where we are.




I use this script to break a big file into several files containing 1.000 *LINES*. Maybe you can use it as a startup point. I use it as a Unix Script. Hope it helps. Riccardo


#!/usr/bin/perl

use strict;
use warnings;

my $out_dir = "path/to/the/destination/directory;

my $num_of_lines = 1000;

my $n = 1;

chomp (my @data = <>);

while (@data) {
        
        my $filename = "/$out_dir/data_$n.txt";
        
        my @partial_data = splice @data, 0, $num_of_lines;
        
        open FILE, ">", $filename or die ($!);
        print FILE "$_\n" for @partial_data;
        close FILE;
        
        $n++;
}





--
------------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to