linux - Sort files according to version -


i have directory names version number such :

1.1.10 1.1.11 1.1.20 2.1.0 1.1.50 3.1.1 1.1.1 

how can sort in following way?

1.1.1 1.1.10 1.1.20 1.1.50 2.1.0 3.1.1 

if sort command not include --sort=version or -v option (i.e. you're in freebsd or osx or you're using gnu sort earlier version 6.0), can sort individual fields, delimited dot. example:

$ text=$'1.1.1\n1.1.10\n1.1.20\n1.2.10\n1.1.2\n1.1.21\n1.1.12\n1.2.1\n' $ echo "$text" | sort -t. -k1,1n -k2,2n -k3,3n 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -