listing file is specific order linux

view story

http://stackoverflow.com – I would like to ask you for help with some script. I have files in one directory with one extension: 1_of_meany_files.ext 2_of_meany_files.ext 3_of_meany_key1_files.ext 5_of_meany_files.ext 6_key2_of_meany_files.ext Now i'm trying build file.txt with list of these files but in specific order: 3_of_meany_key1_files.ext 6_key2_of_meany_files.ext 1_of_meany_files.ext 2_of_meany_files.ext 5_of_meany_files.ext I would be appreciate for help. Thanks Marcin ==EDIT== Hi, Thanks for your help. The scripts are working fine. However I have problem with one thing: If the key word has a digit ins (HowTos)