Q:

Linux : Remove/Delete .txt files ending with exactly five digits

BTW this command worked for me-  rm {path}/*[0-9][0-9][0-9][0-9][0-9].txt
Is there a shorter way? Because as per need we could extend this to
delete all .txt files ending with exactly 10 digits.

--We need to delete files having names like abc12345, ac12456, abcd98653 and so on..

A:

This cmd finds and rm's files with the filename pattern [any number of digits].txt in linux:
find /path/to/search -type f -regextype posix-extended -regex '^.*/[0-9]+\.txt' -exec rm -f {} \;

And this one rm's files with exactly 10 digits.
find /path/to/search -type f -regextype posix-extended -regex '^.*/[0-9]{10}\.txt' -exec rm -f {} \;

Try it without the "-exec rm -f {} \;" bit first to see if it matches the correct files to delete

