bug-coreutils
[Top][All Lists]
Advanced

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

bug#10030: grep: strange behavior with '-' in character class


From: Thomas Dignan
Subject: bug#10030: grep: strange behavior with '-' in character class
Date: Sat, 12 Nov 2011 14:05:32 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110419 Thunderbird/3.1.9

Hello Coreutils Team,

When I use the command:

echo "/lib64/ld-linux-x86-64.so.2" | grep -o '[a-zA-Z\/0-9\-\.]*'

The result is that I get a tokenized string where - has been replaced with \n

/lib64/ld
linux
x86
64.so.2

The expected result is:

/lib64/ld-linux-x86-64.so.2

When the character class is modified so that the - is not next to the number 9:

echo "/lib64/ld-linux-x86-64.so.2" | grep -o '[a-zA-Z\/0-9\.\-]*'

/lib64/ld-linux-x86-64.so.2

The expected result is obtained.

I am aware - is used to specify a range, but it is escaped, should this be the proper behaviour?

Thanks,
Tom





reply via email to

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