Format 1: left(
, length)
Format 2: leftw(
, length)
Extract specified number of characters from the left as defined in the length parameter from the character string
. Use leftw if the string contains multibyte characters.
Extract the first 3 characters in the str column.
$ more dat1.csv
id,str
1,abcdefg
2,12345678
3,
4,12
$ mcal c='left($s{str},3)' a=rsl i=dat1.csv o=rsl1.csv
#END# kgcal a=rsl c=left($s{str},3) i=dat1.csv o=rsl1.csv
$ more rsl1.csv
id,str,rsl
1,abcdefg,abc
2,12345678,123
3,,
4,12,12