Reputation: 9978
I have a file a
:
$ cat a
abcd
kaka
when using the command:
$ grep -e '[a-d]' a
abcd
kaka
It works well, but why those command is not right?
$ grep -e '[\x61-\x74]' a
grep: Invalid range end
$ grep -e '[\u0061-\u0074]' a
grep: Invalid range end
Upvotes: 4
Views: 11639
Reputation: 123608
Assuming that your version of grep
supports PCRE
("Perl-compatible regular expressions"), you can try:
grep -P '[\x61-\x74]' a
This would return the expected output:
abcd
kaka
Upvotes: 3