FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 01-18-2008, 06:10 AM
Dirk Heinrichs
 
Default OT: awk problem

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
 
Old 01-18-2008, 06:22 AM
Dirk Heinrichs
 
Default OT: awk problem

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
 

Thread Tools




All times are GMT. The time now is 12:53 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org