How can I sort file names by version numbers?
In the directory "data" are these files: command-1.9a-setup command-2.0a-setup command-2.0c-setup command-2.0-setup I would like to sort the files to get this result: command-1.9a-setup command-2.0-setup command-2.0a-setup command-2.0c-setup I tried this find /data/ -name 'command-*-setup' | sort --version-sort --field-separator=- -k2 but the output was command-1.9a-setup command-2.0a-setup command-2.0c-setup command-2.0-setup The only way I found that gave me my desired output was tree -v /data How could I get with sort the output in the wanted order? Edit: It turns out that Benoit was sort