regex - use find to match filenames starting with number -


i trying find files have numbers in filenames. example, if have files 123.txt, 45.doc, alpha_123, beta_123.txt, 45 , 123, want match files 45 , 123. have tried various options find , grep or combinations of them, nothing worked wanted or gave me syntax errors.

also there chance can match empty files? tried using option "empty" unsuccessful, although due using wrong syntax.

this find . -name "[0-9]*" kind of worked, in found files numbers in filenames, example file 123 , file 45, found files extension, example 123.txt , 45.doc, , unfortunately not want.

from suggestions below (as original question heavily edited after answers posted), worked wanted $ find . -type f -name '[[:digit:]]*' | grep -e '.*/[0-9]+$'.

i apologise initial misleading/ambiguous post, hope edited version prove helpful other users confused how use find regex.

either this:

$ find -e .  -type f -regex '.*/[[:digit:]]+$' 

or this:

$ find .  -type f -name '[[:digit:]]*' | grep -e '.*/[0-9]+$' 

work find files names composed entirely of digits (i.e., no extension)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -