Gentoo Archives: gentoo-user

From: Dirk Heinrichs <dirk.heinrichs.ext@×××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] OT: awk problem
Date: Fri, 18 Jan 2008 07:11:19
Message-Id: 200801180810.37307.dirk.heinrichs.ext@nsn.com
1 Hi,
2
3 maybe one of you can sched some light on this. I want to match a sequence of
4 two digits with awk, but the following doesn't work
5
6 gawk '/([[:digit:]]){2}/' test_file
7
8 while it works as expected when using egrep, like
9
10 egrep ([[:digit:]]){2} test_file
11
12 Leaving out the interval also works, like in
13
14 gawk '/([[:digit:][:digit:]])/' test_file
15
16 but that would of course get worse when it comes to more than two digits. It
17 also doesn't make a difference if I use [0-9] instead of [[:digit:]].
18
19 According to awk's man page its regular expressions are the same than those
20 used by egrep. What do I miss?
21
22 Thanks...
23
24 Dirk
25 --
26 Dirk Heinrichs | Tel: +49 (0)162 234 3408
27 Configuration Manager | Fax: +49 (0)211 47068 111
28 Capgemini Deutschland | Mail: dirk.heinrichs@×××××××××.com
29 Wanheimerstraße 68 | Web: http://www.capgemini.com
30 D-40468 Düsseldorf | ICQ#: 110037733
31 GPG Public Key C2E467BB | Keyserver: www.keyserver.net

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] [solved] OT: awk problem Dirk Heinrichs <dirk.heinrichs.ext@×××.com>