4.58 line - Line Number

Format: line()

Return the line number processed by mcal command. mcmd standarize all line numbers starting from 0, similarly, line function initializes the first row of data from 0.

Examples

Example 1: Basic Example

Print number starting from 0 in output.

$ more dat1.csv
id
1
2
3
4
$ mcal c='line()' a=no i=dat1.csv o=rsl1.csv
#END# kgcal a=no c=line() i=dat1.csv o=rsl1.csv
$ more rsl1.csv
id,no
1,0
2,1
3,2
4,3

Example 2: Start from 1

Print number starting from 1 in output.

$ mcal c='line()+1' a=no i=dat1.csv o=rsl2.csv
#END# kgcal a=no c=line()+1 i=dat1.csv o=rsl2.csv
$ more rsl2.csv
id,no
1,1
2,2
3,3
4,4