I'm trying to find all files for which there name starts with a capital letter. I have tried using the following command:
find . -type f -regex '.*\/[A-Z][^/]*'
It's finding paths with only lowercase letters. The following works:
find . -type f -regex '.*\/[ABCDEFGHIJKLMNOPQRSTUVWXYZ][^/]*'
As does:
find . -type f | grep '.*\/[A-Z][^/]*$'
I've tried all the different options for regextype
, with the same result.
Why does find
include lowercase letters in [A-Z]
? I thought the regex for that was [a-zA-Z]
. Is there any way to specify a range of only uppercase letters in find
?
LC_ALL=C find ...
?\/
)? Also what find are you using (find --version
)?/
is only necessary when you're using it as a delimiter, e.g. ins/foo\/bar/foobar/
. (But often you can use some other delimiter:s#foo/bar#foobar#
.)