Command to Search for Filenames Exceeding 143 Characters?
Although the GNU ‘findutils-default’ regular expression syntax doesn't provide a {n,m}
interval quantifier, you can use a -regex
test in GNU find
if you select a different regextype
, for example:
find . -regextype posix-extended -regex '.*/[^/]{143,}$'
or
find . -regextype egrep -regex '.*/[^/]{143,}$'
or
find . -regextype posix-basic -regex '.*/[^/]\{143,\}$'
etc. There may be other regextypes
that support {n,m}
intervals, either with or without escaping.
Compared to piping the results of find
to a separate grep
command, this will match across newlines (i.e. the find
regex flavors differ from their namesakes in that .
matches the newline character by default).
Try:
find /your/path | grep -E '[^/]{143,}$'
If you've already got a locate db, it is very fast at this.
locate --regex '.*/[^/]{143,}$'