Chapter 4 . Processing Text 179 (Domain and web hosting) Dividing files
Chapter 4 . Processing Text 179 Dividing files into multiple pieces The split utility is used to divide one long file into many different files. This utility creates files all of a certain length, with a default length of 1,000 lines, and sequentially names the files. The filenames are made of a prefix, which is x by default, followed by a letter combination. The letter combination follows the pattern of aa, ab, ac, and so on. If there are more than 676 files being created, the syntax used is zaa, zab, and so on. The split utility is capable of using either standard input or a file as input; when no file is specified, standard input is used. The correct syntax when using the split utility is as follows: # split -options INPUTPREFIX Several options, shown in Table 4-11, can be used to customize the output of the split utility. Table 4-11 Options Used with split Option Use -b BYTES Specifies the number of bytes to be placed in each file. If the number is followed by b, the amount is multiplied by 512; if a k is used, the number is multiplied by 1024; and if an m is used, the number is multiplied by 1,048,576. -C BYTES Works like the -b option except as many completed lines of data are placed in the file as possible without exceeding the number of BYTES specified. –verbose Writes diagnostics to standard error before each file is opened. –help Displays help information and exits. –version Displays version information and exits. -l LINES Specifies the number of lines contained in each output file. In the following example the nameslistfile is split into several files each containing five lines. # split -l 5 nameslist names # ls names* namesaa namesab
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.