Unable to list files in ascending order

Hi !

I am just trying to list my files in ascending order so that in some other software, I just want merge with some modification, when I list its coming like this

new-10.txt
new-11.txt
new-12.txt
new-13.txt
new-14.txt
new-15.txt
new-16.txt
new-17.txt
new-18.txt
new-19.txt
new-1.txt
new-20.txt
new-21.txt
new-22.txt
new-23.txt
new-24.txt
new-25.txt
new-26.txt
new-27.txt
new-28.txt
new-29.txt
new-2.txt
awk 'NR==1 || $'$my_col'<p{close(f); f="'$name'-"++i".txt"}{print>f; p=$'$my_col'}' $file

I used above awk script to write new file by using some big file...

Please help me to list it in ascending order like this

new-1.txt
new-2.txt
new-3.txt
new-4.txt
new-5.txt
new-6.txt
new-7.txt

Hi

Pipe your file listing output to this command:

sort -t"-" -k2n,2  
1 Like

Thank you so much.