Script to list Sequential files

I have sequential files like this. I'm trying to write a bash shell script to list all of them. These files are part of mysql to do database point in time recovery

bin.000001
.
.
.
bin.000999

I have something like this but it won't display bin.000010 and up. If anyone has a solution pls do let me know.

# find ~/ -name 'bin.00000[0-99]

Each character set [ ] matches one character

find ~/ -name 'bin.000[0-9][0-9][0-9]'

Thanks madelngermany,

I used find ~/ -name 'bin.0000[01-9][10-999]' and it worked.

Can you explain what is [01-9][10-999]?

A bit difficult to believe your pattern matched bin.000999 as it is for the last two digits only, one per square bracket pattern. First pattern will match 0 and 1-9, second 1, 0-9, 9, and 9 (some redundancy, i'd say).

Sorry, I made a mistake, my code did not work and i used your code it's working.
Can you explain what is [0-9][0-9][0-9]

man bash :

So one [0-9] means one character from (the range) 0 through 9.

2 Likes