Process only 4 digit odd number starting with zero

I am trying to process only IonCode_odd #'s (always 4 digits starting with zero), but the below isn't working as expected. Is there a better way? Thank you :).

IonCode_0401_xxxx_xxxx_xxxx.bam
IonCode_0401_xxxx_xxxx_xxxx.bam.bai
IonCode_0401_xxxx_xxxx_xxxx.fastq
IonCode_0402_xxxx_xxxx_xxxx.bam
IonCode_0402_xxxx_xxxx_xxxx.fastq
IonCode_0407_xxxx_xxxx_xxxx.bam
IonCode_0407_xxxx_xxxx_xxxx.bam.bai
IonCode_0407_xxxx_xxxx_xxxx.fastq

desired

only IonCode_0401_xxxx_xxxx_xxxx.bam and IonCode_0407_xxxx_xxxx_xxxx.bam processed... IonCode_0402 is skipped.
md5sum /path/to/*IonCode_[0-9][0-9][0-9][0-9][03579]*.bam: No such file or directory
md5sum /path/to/IonCode_[0-9][0-9][0-9][0-9][03579]*.bam: No such file or directory

On the contrary, it is working as programmed (and thus as expected). It looks for 5 digit numbers starting with any digit (not zero only as specified) and ending in 0 (not 1), 3, 5, 7, or 9.

For your problem, try instead

md5sum /path/to/IonCode_0[0-9][0-9][13579]*.bam
1 Like

Thank you very much :slight_smile:

Moderator comments were removed during original forum migration.