Convention for specifying column numbers on command line
This manual page describes the syntax for specifying column numbers on the command line of some utilities.
Normally, columns are specified by their number as they appear in input files, starting from one. Each column number must be separated by a comma, and no white spaces must appear in the list. For example:
1,2,5,4specifies columns 1, 2, 5 and 4. If the utility outputs data from these columns as they appear in the list, this example would also correspond to a rearranging of columns.
A comma separated field can also define a range instead of specifying the number of a column. The syntax is similar to ranges in Matlab. For example:
3:2:12is equivalent to 3,5,7,9,11. However, ranges specified this way must contain three values (in contradiction with Matlab where only two values are also accepted). If the step value is negative, columns will be taken in the reverse order. For example:
12:-2:3is equivalent to 12,10,8,6,4. An increasing range with a step value of one can also be specified like
5-7which is equivalent to 5,6,7.
These formats can be mixed. For example:
5,2,20:-2:16,1-3,5,6:3:12which is equivalent to 5,2,20,18,16,1,2,3,5,6,9,12.
Manual page written by Pierre Jaccard, Geophysical Institute, University of Bergen, 1999.