Bug#730534: gawk: patsplit values and separators result arrays seem to be switched

2018-09-14 Thread Adrian Bunk
On Tue, Nov 26, 2013 at 11:40:01AM +0200, alex bodnaru wrote:
> Package: gawk
> Version: 1:4.0.1+dfsg-2.1
> Severity: normal
> 
> Dear Maintainer,

Dear Alex,

> thank you for maintaining this package.
> 
> wishing to make a filter in the bluefish editor, i turned to awk.
> i needed to perform a matchall equivalent, so split/patsplit were chosen.
> the gawk man says "patsplit(s, a [, r [, seps] ])" the sepatator matches 
> would be in the last param, as with split.
> in reality, for patsplit they were switched, as opposed to split, 
> where they matched the man.
> i don't know which of them: the man or the program is to be fixed.

first of all apologies for the late reply.

Perhaps I am missing something, but it seems to work for me:

$ echo 'foo,bar.baz' | awk '{n = patsplit($0,a,/[^,|.]*/,b); for(i=1;i<=n;i++) 
print a[i] " " b[i]}'
foo ,
bar .
baz 
$ 

> thanks again,
> alex

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed



Bug#730534: gawk: patsplit values and separators result arrays seem to be switched

2013-11-26 Thread alex bodnaru
Package: gawk
Version: 1:4.0.1+dfsg-2.1
Severity: normal

Dear Maintainer,

thank you for maintaining this package.

wishing to make a filter in the bluefish editor, i turned to awk.
i needed to perform a matchall equivalent, so split/patsplit were chosen.
the gawk man says "patsplit(s, a [, r [, seps] ])" the sepatator matches 
would be in the last param, as with split.
in reality, for patsplit they were switched, as opposed to split, 
where they matched the man.
i don't know which of them: the man or the program is to be fixed.

thanks again,
alex


-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (300, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.11-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gawk depends on:
ii  libc6 2.17-93
ii  libreadline6  6.2+dfsg-0.1
ii  libsigsegv2   2.10-2

gawk recommends no packages.

Versions of packages gawk suggests:
pn  gawk-doc  

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org