public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] OT: awk problem
@ 2008-01-18  7:10 Dirk Heinrichs
  2008-01-18  7:22 ` [gentoo-user] [solved] " Dirk Heinrichs
  0 siblings, 1 reply; 2+ messages in thread
From: Dirk Heinrichs @ 2008-01-18  7:10 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

Hi,

maybe one of you can sched some light on this. I want to match a sequence of 
two digits with awk, but the following doesn't work

gawk '/([[:digit:]]){2}/' test_file

while it works as expected when using egrep, like

egrep ([[:digit:]]){2} test_file

Leaving out the interval also works, like in

gawk '/([[:digit:][:digit:]])/' test_file

but that would of course get worse when it comes to more than two digits. It 
also doesn't make a difference if I use [0-9] instead of [[:digit:]].

According to awk's man page its regular expressions are the same than those 
used by egrep. What do I miss?

Thanks...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Wanheimerstraße 68      | Web:  http://www.capgemini.com
D-40468 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-user] [solved] OT: awk problem
  2008-01-18  7:10 [gentoo-user] OT: awk problem Dirk Heinrichs
@ 2008-01-18  7:22 ` Dirk Heinrichs
  0 siblings, 0 replies; 2+ messages in thread
From: Dirk Heinrichs @ 2008-01-18  7:22 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

Am Freitag, 18. Januar 2008 schrieb ext Dirk Heinrichs:

> maybe one of you can sched some light on this. I want to match a sequence
> of two digits with awk, but the following doesn't work
>
> gawk '/([[:digit:]]){2}/' test_file

Seems I need the --posix option for this to work.

Sorry for bothering you.

Bye...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Wanheimerstraße 68      | Web:  http://www.capgemini.com
D-40468 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-18  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-18  7:10 [gentoo-user] OT: awk problem Dirk Heinrichs
2008-01-18  7:22 ` [gentoo-user] [solved] " Dirk Heinrichs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox