On 02/26/2015 06:28 AM, George Shuklin wrote: > $ echo 'sample-text'|egrep '[0-9\-a-z]' > grep: Invalid range end There are different regex flavors. Some, like perl, allow you to write [...\-...] to include a literal '-' in the middle of a larger set of characters. But others, like the POSIX BRE (basic) and ERE (extended) flavors do not. In these flavors, the ONLY way to include literal '-' in a character set is to put it at the front or at the back of the set being enumerated. Any appearance of '\' in the set is taken literally; there is no way to use '\' as an escape character. Thus, your attempt here is requesting the set consisting of the range from '0' to '9', from '\' to 'a', and then an unexpected '-' character that is not the end. It is invalid per POSIX. > > but: > > $ echo 'sample-text'|egrep '[0-9a-z\-]' This requests the set from '0' to '0', the set from 'a' to 'z', the literal '\', and the literal '-'. As Bernhard pointed out, this is not a coreutils bug. But it is also not a grep bug. It is your usage that is at fault. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org