bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] gawk handling of "." in regular expressions


From: Liddell, Dan
Subject: [bug-gawk] gawk handling of "." in regular expressions
Date: Fri, 28 Dec 2018 01:20:08 +0000

Hi,

In the current gawk documentation:

https://www.gnu.org/software/gawk/manual/html_node/Regexp-Operators.html#Regexp-Operators

This is stated under the period (.) operator section:

                "This matches any single character, including the newline 
character."

I'm wondering about the newline character claim.

Here is an example from Linux.

$ awk --version
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1-p11, GNU MP 6.1.2)
$ cat test
foo
bar
# the only character between foo and bar is a newline
# as demonstrated here:
$ xxd -p test
666f6f0a6261720a
# here, 0a is the hex form for newline.
# now test whether "." can match a newline.
$ cat test | awk '/foo.bar/'

# no output.

It seems a newline is not matched by ".", contrary to the documentation.

Bug or misunderstanding?

Thanks,
dan



reply via email to

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