chan_permute — operate on columns of files.
chan_permute
-i infile1
id
id
... [ -i infile2
id
... ] -o outfile1
id
id
... [ -o outfile2
id
... ]
This program mixes, matches, and merges ASCII files organized in channels or columns. Each word, separated by whitespaces, should be less than 40 characters long. The channels in each input file are specified and then mapped to the desired channels in the output file(s). These are the sort of things that can be done using cut and paste, but when working on animation tables it's often nice to be able to do it in one step.
Infiles are files to be read from, outfiles are files to be written to, and each id is a small positive integer identifying a channel. All of the input id's should be distinct integers, or the results are not guaranteed.
chan_permute
interprets
-i stdin
as standard input and
-o stdout
as
standard output.
The command
chan_permute -i foo 0 1 2 -o stdout 2 1 0
reverses the order of foo's three columns and sends them to standard output.
The command
chan_permute -i file1 0 1 -i file2 2 3 -o file3 2 0 1 -o file4 3 0 1
creates file3 and file4, each containing one of the columns of file2 followed by both columns of file1.
A given file may be referenced more than once for input, but may not be referenced for input and output together or output and output together. In the latter case, the second output reference overrides the other. The id's must be integers somewhere between 0 and the number of arguments, inclusive.