Assuming you’re using GNU sort, use the-V option:
-V, --version-sort
natural sort of (version) numbers within text
For your input, it’d produce:
test1.pdf
test2.pdf
test10.pdf
Assuming you’re using GNU sort, use the-V option:
-V, --version-sort
natural sort of (version) numbers within text
For your input, it’d produce:
test1.pdf
test2.pdf
test10.pdf