File Splitting

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: sinck@ugive.comsinckugive.com
Date:  
Subject: 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