Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


FileDiv

Tool

SYNTAX

FileDiv file [prefix] [-b] [-f] [-n splitPoint] [-p] [-s n]

DESCRIPTION

The FileDiv tool divides a file into several smaller files, each containing an equal number of lines or bytes (-b). Normally FileDiv splits the file into files of 2000 lines or 10,000 bytes, but you can specify the number of lines or bytes in each file with the -n option. In either case the last file contains the remaining lines or bytes.

INPUT

An input file (file). FileDiv does not accept standard input.

OUTPUT

FileDiv creates output files named according to the form fileNN, where file is the original filename and NN is a number. As an alternative, you can change the filenames to the form prefixNN by specifying the prefix parameter.

Note
Output files are named according to the actual name of the source file, not any alias used to specify the file. You can use the prefix parameter to specify the output filename prefix if you use an alias to specify the source file and want the output files to be named after the alias. •

STATUS

FileDiv can return the following status codes:

0

no errors

1

parameter or option error

PARAMETERS

file

Specifies the input file to be divided.

prefix

Specifies the prefix of the output filenames, which have the form prefixNN, where NN is a number. If you omit this parameter, FileDiv creates filenames using the form fileNN.

OPTIONS

-b

Splits the input file into files of splitPoint bytes rather than lines. Normally FileDiv reads the input file as a sequence of text file lines, but if you specify this option, it reads the file as a stream of bytes.

-f

Splits the input file at form-feed characters (ASCII $0C) as long as they appear as the first character on a line and each output file contains at least splitPoint lines. The line containing the form feed becomes the first line in the next output file. Note that FileDiv ignores this option if you also specify -b.

-n splitPoint

Splits the input file into files of splitPoint lines or bytes. If you omit this option, FileDiv assumes the default split point of 2000 lines or 10,000 bytes.

-p

Writes progress and version information to diagnostic output.

-s n

Changes the sizes of the input and output buffers for byte streams, which are computed according to the formula n*512 bytes, according to the value of n.

This option accepts values of n from 1 to 512, allowing you to specify buffers in the range of 512 to 262,144. Using 128 as the default value of n, this formula produces a buffer of 65,536 bytes.

EXAMPLES

The following command line splits BigFile into files of exactly 8000 bytes. The output files are named SmallerFileNN, where NN is 01, 02, and so on.

FileDiv BigFile SmallerFile -b -n 8000

The -f option causes FileDiv to divide files at form-feed characters rather than at a precise number of lines. The following command line uses this dividing method to split BigFile into files of at least 2500 lines. FileDiv names the output files BigFileNN.

FileDiv BigFile -f -n 2500

LIMITATIONS

The maximum input line length is 255 characters.

 
 


Last Updated July 2000