List files sorted numerically in bash

hi friends,
how to sort files by extension by numeric portion in bash please?

e.g I have below below files
file.name.XMLSchema10
file.name.XMLSchema46
file.name.XMLSchema47
file.name.XMLSchema7
file.name.XMLSchema469
file.name.XMLSchema470
file.name.XMLSchema471
file.name.XMLSchema472
file.name.XMLSchema273
file.name.XMLSchema374
file.name.XMLSchema475
file.name.XMLSchema576
file.name.XMLSchema177
file.name.XMLSchema178
file.name.XMLSchema179
file.name.XMLSchema180
file.name.XMLSchema181
file.name.XMLSchema182
file.name.XMLSchema183
file.name.XMLSchema184
file.name.XMLSchema185
file.name.XMLSchema186
file.name.XMLSchema187
file.name.XMLSchema188
file.name.XMLSchema189
file.name.XMLSchema90
file.name.XMLSchema491
enthuguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

enthuguyAuthor Commented:
Thx wollmilkporc for your quick help.

not getting the output in order. Is it possible to get in asec (lowest at the top) pls
woolmilkporcCommented:
Sorry, I noticed myself that my solution doesn't work - that's why I deleted my comment.

Let's see if  I can find a better solution!
enthuguyAuthor Commented:
Thanks very much :)
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

woolmilkporcCommented:
There is a GNU extension to "ls" which should do what you desire:

ls -1 -v file.name.*

Please note: "-1" is the digit "1", not the letter "l". We use it here to force one-column output.

Working on a solution with filenames in a file ...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
enthuguyAuthor Commented:
Thx very much that helped! :)
mankowitzCommented:
for file in file.name.XMLSchema{1..1000}; do
    ls "$file"
done
enthuguyAuthor Commented:
thx mankowitz, I believe this will list up to file.name.XMLSchema1000 even if the actual file "file.name.XMLSchema1000" doesn't exist?

file.name.XMLSchema1
file.name.XMLSchema2
.
.
.
file.name.XMLSchema1000

pls correct me if I was wrong
mankowitzCommented:
it shouldnt. If the file is not there, ls should return empty.
enthuguyAuthor Commented:
oh Yeah, I was wrong...sorry

thanks
woolmilkporcCommented:
A possible solution for sorting a list of files "filelist":

sed 's/\(file\.name\.XMLSchema\)\(.*$\)/\1 \2/' filelist | sort -k2n | tr -d " "

The file names must not contain spaces for this solution to work!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.