This was similar to BASH: how to loop all files in sorted order but different enough I felt-
I have a series of files prepended with pound sign and number that in bash by default get ordered like this:
#1 Clear.png
#10 Brilliant Blue.png
#11 Caribbean Blue.png
#12 Aquamarine.png
#13 Teal.png
#14 Turquoise.png
#15 Green.png
#16 Light Green.png
#17 Purple.png
#18 Lt Purple.png
#19 Yellow.png
#2 Standard Pink.png
#20 Brown.png
#3 Light Pink.png
#4 Fuschia.png
#5 Wine.png
#6 Red.png
#7 Orange.png
#8 Blue.png
#9 Light Blue.png
Id like to sort these in a for loop by their numeric value in front of the pound sign in this order i.e. something like
for i in `ls * | sort [method to sort]`; do
*stuff*
done
The issue is that none of the sorting solutions I have found seem readily usable for sorting this case with a pound sign and/or spaces.
Order files should be sorted:
#1 Clear.png
#2 Standard Pink.png
#3 Light Pink.png
#4 Fuschia.png
#5 Wine.png
#6 Red.png
#7 Orange.png
#8 Blue.png
#9 Light Blue.png
#10 Brilliant Blue.png
#11 Caribbean Blue.png
#12 Aquamarine.png
#13 Teal.png
#14 Turquoise.png
#15 Green.png
#16 Light Green.png
#17 Purple.png
#18 Lt Purple.png
#19 Yellow.png
#20 Brown.png