Skip to end of metadata
Go to start of metadata

Among all, csv-paste can number lines of its output. Now, individualised parameters have been added, if there are several instances of line-number in command line parameters. Examples:

> # append single line number
> seq 0 11 | csv-paste - line-number
0,0
1,1
2,2
3,3
4,4
5,5
6,6
7,7
8,8
9,9
10,10
11,11
 
> # number blocks of records
> seq 0 12 | csv-paste - line-number --size 3
0,0
1,0
2,0
3,1
4,1
5,1
6,2
7,2
8,2
9,3
10,3
11,3
12,4
 
> # create multiple indices (e.g. if you need to express multidimensional array indices)
> seq 0 11 | csv-paste - "line-number;size=4" "line-number;size=4;index"
0,0,0
1,0,1
2,0,2
3,0,3
4,1,0
5,1,1
6,1,2
7,1,3
8,2,0
9,2,1
10,2,2
11,2,3
 
> # reverse indices (e.g. to use with csv-blocks down your pipeline)
> seq 0 11 | csv-paste - "line-number;size=4" "line-number;size=4;index;reverse"
0,0,3
1,0,2
2,0,1
3,0,0
4,1,3
5,1,2
6,1,1
7,1,0
8,2,3
9,2,2
10,2,1
11,2,0

As other comma utilities, all the operations csv-paste can operate on ascii or binary data. See csv-paste --help for more configuration possibilities.

  • No labels