Admin Stuff

To sort version numbers, of the form 'i.j.k.l ...' we first pad each of the digits with 0 on the left to have three digits. Then we can sort them and afterwards remove the superflous digits:

 $ padversion() { sed -r -e :a -e 's/(\.|^)([0-9][0-9]?(\.|$))/\10\2/' -e ta }
 $ trimversion() { sed -r -e 's/(^|\.)00?/\1/g' }
 $ echo -e "2.3.12\n2.3.2\n1.20\n3" | padversion | sort | trimversion
 1.20
 2.3.2
 2.3.12
 3


Or given a list of version numbers, output a sorted list of those above version $x

 $ x=2.3.10
 $ echo -e "2.3.12\n2.3.2\n1.20\n3" | padversion \
       | awk -v "x=`echo "$x" | padversion`" '$1>x {print}' \
       | sort | trimversion
 2.3.12
 3