bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] 2 questions


From: Aharon Robbins
Subject: Re: [bug-gawk] 2 questions
Date: Sun, 28 Oct 2012 12:53:16 +0200
User-agent: Heirloom mailx 12.5 6/20/10

Hello. Re this:

> Date: Fri, 26 Oct 2012 22:03:24 +0300
> From: Denis Shirokov <address@hidden>
> To: address@hidden
> Subject: [bug-gawk] 2 questions
>
> Hi GAWK!
>
> Would you be so kind to answer for 2 questions:
>
>
> 1) because /\1B\x2A/ response in regexp as /*/ - this mean that regexp
> cant process byte-characters with code \x80-\xFF ? or some of thems?
> is there way to process characters with code \x80-\xFF ?

In general, you should use printable characters for the code that
are printable, such as '*' for \x2A. Then it becomes clear what
the problem is.

Gawk can match characters in the range \x80 - \xFF. You simply put
them into the regex that way. Or you can enclose them in square brackets,
in which case they will generally lose any special meaning.

> 2) How character "/" being defined in gawk-script:
>  as arithmetic divider (like 1/5 (==0.2), 10/1 (==10), etc...)
> OR
>  as the begining of regexp? (like /2/)

Both.

> CAUSE:
>
> 1/2/3      - may mean:(number 1 divided by number 2 divided number by
> 3) ==0.1666666666666667

This is the interpretation taken by Brian Kernighan's awk, gawk, and mawk.

> OR
>
> 1/2/3      - may mean:(number 1 regexp /2/ number 3) =="103"  ( rexp /2/==0)
>
> How you  can exactly be sure which expressions is used?

Awk interpreters generally do the right thing.  You can use parentheses
to force a particular interpretation.

Arnold



reply via email to

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