[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
report a bug of the function of patsplit
From: |
???????? |
Subject: |
report a bug of the function of patsplit |
Date: |
Tue, 18 Aug 2020 13:25:16 +0800 |
Hi, guys:
I find that the function of patsplit has a bug.
patsplit(string, array [, fieldpat[, seps]]) : To save pieces
into 'array', store separator into 'seps'. But this function saves pieces into
'seps', not strore into 'array'
// souce codes
[root@novice commands]# echo "chinaos cnaps mmnasten" | gawk '{ patsplit($0,
arr,"na", sepp )} END{ for( x in arr){ print "arr[" x "]=" arr[x]}; for( y in
sepp){ print "sepp[" y "]=", sepp[y]}}'
arr[1]=na
arr[2]=na
arr[3]=na
sepp[0]= chi
sepp[1]= os c
sepp[2]= ps mm
sepp[3]= sten
[root@novice commands]# echo "chinaos cnaps mmnasten" | gawk '{ patsplit($0,
arr,"na", sepp )} END{ for( x in arr){ print "arr[" x "]=" arr[x]}; for( y in
sepp){ print "sepp[" y "]=", sepp[y]}}'
arr[1]=na
arr[2]=na
arr[3]=na
sepp[0]= chi
sepp[1]= os c
sepp[2]= ps mm
sepp[3]= sten
Good luck.
??????????????
- report a bug of the function of patsplit,
???????? <=
Re: report a bug of the function of patsplit, arnold, 2020/08/19