bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gawk bug with RS="^..."


From: Stepan Kasal
Subject: gawk bug with RS="^..."
Date: Tue, 14 Dec 2004 14:48:58 +0100
User-agent: Mutt/1.4.1i

Hello,
  I've noticed a problem with "^" in RS in gawk.  In most cases, it seems
to match only the beginning of the file.  But in fact it matches the
beginning of gawk's internal buffer.

Observe the following example:

$ gawk 'BEGIN{for(i=1;i<=100;i++) print "Axxxxxx"}' >file
$ gawk 'BEGIN{RS="^A"} END{print NR}' file
2
$ gawk 'BEGIN{RS="^Ax*\n"} END{print NR}' file
100
$ head file | gawk 'BEGIN{RS="^Ax*\n"} END{print NR}'
10
$

I think this calls for some clarification/fix.  But I don't have any
fixed opinion how the solution should look like.

Have a nice day,
        Stepan Kasal

PS: See also the discussion of the issue in the comp.lang.awk newsgroup.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]