[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: report a bug of the function of patsplit
From: |
arnold |
Subject: |
Re: report a bug of the function of patsplit |
Date: |
Wed, 19 Aug 2020 01:51:08 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Hi.
As Wolfgang and Andrew have said, patsplit() is working as designed. It looks
like you want the split() function.
Thanks,
Arnold
"天骄之鹰" <tianjiaozhiying@qq.com> wrote:
> 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.
>
> 天才就是毅力!
Re: report a bug of the function of patsplit,
arnold <=