is a tricky command with lots of options, and it takes some time to learn. Start with these links:
Note that the -name
option uses globbing
(not exactly the shell globbing in the link, but broadly the same), and only tries to match the filename itself, not the path in front of it. The -regex
option used above, OTOH, uses more powerful regular expressions
, and attempts to match the entire input filepath.
Assuming the filenames are exactly as posted, with the number occurring at the end of the name, globbing matches could look like this:
find /home/manoj -type f -name "*[^0-9]12" -print
find /home/manoj -type f -name "*[^0-9]123" -print
The [^0-9] ensures that the expression matches the number exactly, and won't also match "file 212", and similar.
has several other matching features. Read the man page for them all.