[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] regexp that cannot match anything
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] regexp that cannot match anything |
Date: |
Mon, 21 Jan 2013 20:40:43 +0200 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
> Date: Mon, 21 Jan 2013 08:48:23 +0200
> From: Denis Shirokov <address@hidden>
> To: address@hidden
> Subject: [bug-gawk] regexp that cannot match anything
>
> Hi GAWK!
Noone on this list is actually named "GAWK". It would be more correct
to either say simply "Hello", or "Hello Gawk Developers".
> I try to read using getline operator whole file as the single string.
> As i read in the manual - var RS can be regular expression matching
> record separator.
>
> Am i right that following example will always read whole file without
> separation?
>
> BINMODE="rw"; RS="\\x00{0}"
> getline d < "filename"
No - this doesn't work. The behavior of 0 in an interval expression
is not well defined.
IF you know for sure that there are no zero bytes in your file,
then you can use RS = "\0" and that will read the whole file.
> If no then is there a way to implement regexp that cannot match
> anything? (for example by /[^.]/ - not any char)
A period inside a bracket expression loses its special meaning. You might
try something like RS = "[^\x00-\xFF]" .
HTH,
Arnold