MeatAxe
2.4

zct Options Rows[:Columns] Input Output
This program cuts a piece, specified by Rows and Columns, out of the file Input, and writes the piece to Output. The input may be a matrix or a set of permutations. Both Rows and Columns are lists of positive integers or ranges (e.g., "1325") separated by commas. If the input is a matrix, the corresponding rows and columns are cut, and the resulting rectangular pieces are combined into one rectangular matrix which is written to the output file. If the columns list is omitted, all columns of the selected rows are cut.
Here are some examples. Assume the input is the following 5 by 10 matrix
1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 0 0 0 0 0 0 0 0 0 0 9 8 7 6 5 4 3 2 1 0
Then, zct would produce the output shown below for different Rows:Columns lists:
Rows:Columns Result   1,45 1 2 3 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 0 9 8 7 6 5 4 3 2 1 0 13:810 8 9 0 7 8 9 6 7 8 12:2,57,9 2 5 6 7 9 1 4 5 6 8 12,5:13,910 1 2 3 9 0 0 1 2 8 9 9 8 7 1 0
The rows and columns which select the piece need not occur in ascending order, but the output depends on the ordering. For example,
zct 1,2 output input zct 2,1 output input
both extract the first two rows of ‘input’, but the second form will also permute the rows. Another example:
zct 34,12:34,12 inp out
would perform the following operation on a 4 by 4 matrix:
inp out 1 1 2 2 4 4 3 3 1 1 2 2 4 4 3 3 3 3 4 4 2 2 1 1 3 3 4 4 2 2 1 1
With permutations the program works in the same way as with matrices. Each permutation is treated as a row. The Columns list must be empty in this case, because zct can cut only entire permutations.
The number of entries in the Rows and Columns list must not be greater than 10. One row (or permutation, respectively) of the input file and the whole result of the cut must fit into memory.