in reply to divide the large files to small

I'd use the command line utility split. It's designed for that task - no need to reinvent the wheel.

Replies are listed 'Best First'.
Re^2: divide the large files to small
by ack (Deacon) on Mar 10, 2010 at 21:33 UTC

    One CAUTION: I don't think the command line utility split exists on all OS's (e.g., I'm not aware of it on MS OSs).

    But it certainly is easy enough to write a Perl script to either do the equivalent of split or to use toolic's solution in his referenced post.

    ack Albuquerque, NM
      One CAUTION: I don't think the command line utility split exists on all OS's (e.g., I'm not aware of it on MS OSs).
      That depends what you mean by "existing". If you mean, "split" isn't available after installing MS OSses, you are probably right. But last time I looked, Perl didn't come with those OSses either. OTOH, I'd be extremely surprised if there wasn't a Windows port for split. All common Unix tools have been ported to Windows.

        To name just one I found a long time ago: HJSplit -- ugly, but it gets the job done.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)