File Splitting

Páxina inicial
Anexos:
Mensaxe orixinal
+ (text/plain)
Borrar esta mensaxe
Responder a esta mensaxe
Autor: sinck@ugive.com
Data:  
Asunto: File Splitting

\_ Can you help me out?
Which way did you come in? :-)

\_ How are you splitting your files, I am in need of away to take a large plain
\_ text database report and break it up into small pieces.

In this case, split isn't your friend, since it doesn't care about
line breaks, which, presumably your plain text database does.

Try successive runs of tail and head, or the following perl script

#!/usr/bin/perl

# invoke: thisfile.pl file_to_split

# YMMV

$lines = 100;      # how many lines/file
$outfile = "xaa";  # base


open (F, "> $outfile");  # initial
while (<>)
{
   print F;
   if (! ($. % $lines))
   {
      close (F);
      $outfile++;  # perl magic
      open (F, "> $outfile");
   }
}    
close(F);



# David