File Splitting

トップ ページ
添付ファイル:
Eメールのメッセージ
+ (text/plain)
このメッセージを削除
このメッセージに返信
著者: sinck@ugive.comsinckugive.com
日付:  
題目: 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