rsplit - splits standard input into multiple output files or streams
rsplit [ -tS ][ -ih ][ -iH ][ -oh ][ -oH ][ -x xres -y yres ][ -oaN | -ofN | -odN | -ocN | -oiN | -owN | -obN ][ -f ][ -a ][ -on M ] output1 [options] output2 ..
Rsplit writes lines or fields from the standard input to one or more output streams. By default, fields are separated by a newline character (i.e., input is distributed by lines), but the terminator can be changed using the -t option. If a space is specified as the terminator, then fields are separated by any number of white spaces, including tabs, returns, and newlines. Different terminators may be given for different fields by specifying additional -t options between each output specification. Note that there is no space between this option and its argument, and certain arguments, such as a space or a tab, must be quoted or escaped with a backslash in most shells. If no argument is given, the default newline terminator is re-established.
Output is either to a file, to a command, to the standard output, or to discard. If a named output file exists, it will not be overwritten unless the -f option is given, or it is being appended using the -a option. The same output file may not appear more than once. Commands are given in quotes, and begin with an exclamantion point (’!’). At most, one command may reliably write to its standard output, and doing so is incompatible with rsplit also writing to standard output. A hyphen (’-’) by itself tells rsplit to write directly to its standard output, and may appear multiple times. The options before the first appearance determine the standard output header parameters. A period (’.’) tells rsplit to discard the corresponding data, and also may appear multiple times.
The -oa option may be used to specify ASCII data (the default), or the -of option may be used to indicated binary IEEE 32-bit floats. Similarly, the -od and -oi options may be used to indicate binary 64-bit doubles or integer words, respectively. The -ow option specifies 2-byte short words, and the -ob option specifies bytes. If a number immediately follows any of these options, then it indicates that multiple such values are expected for each record. For example, -of3 indicates three floats per output record for the next named output. In the case of the -oa option, no number writes one line or field per stream, and numbers greater than zero write multiple fields per record to the same stream. If the terminating character is set to something other than newline (’\n’), a newline is added after each record (in addition to the terminator). For binary output formts, no number implies one value per output. No terminator characters are expected or written for binary outputs.
If a -on option is given with a positive integer argument, this will be the maximum number of records that will be written by rsplit.
The -ih option tells rsplit to expect a Radiance header on its input. The -iH option says to expect a resolution string for an image or similar. The -x and -y options may alternatively be used to specify the input dimensions. The -oh option tells rsplit to produce a Radiance header on the next output stream. The -oH option will write a resolution string. These options toggle the associated mode on and off, so it is possible to have one output include a header or resolution string and not the next by specifying the option(s) again. Neither -oh nor -oH may be used with the append mode (’-a’), which may also be toggled.
To alternate 5 lines between two output files:
rsplit -oa5 output1.txt output2.txt < input.txt |
To send the first of each double precision triplet to one file, and the second and third to a second file, stopping after 500 triplets:
rsplit -on 500 -od firstvals.dbl -od2 followingpairs.dbl < triplets.dbl |
To convey material, color and distance information from rtrace to separate files:
vwrays [viewspec] | rtrace [options] -x 1024 -y 768 -h+ -oMlv octree | rsplit -ih -iH -t^I mats.txt -of depth.zbf -oh -oH -of3 ’!pvalue -r -df > image.hdr’ |
Greg Ward
cnt(1), histo(1), neaten(1), rcalc(1), rcode_depth(1), rcode_ident(1), rcode_norm(1), rcode2bmp(1), rcrop(1), rlam(1), rtpict(1), rtrace(1), split(1), tabfunc(1), total(1)