Help to sort out... Possible use of sort command

I have an input like

4.3.6.66
4.3.6.67
4.3.6.70
4.3.6.25
4.3.6.15
4.3.6.54
4.3.6.44
4.3.6.34
4.3.6.24
4.3.6.14
4.3.6.53
4.3.6.43
4.3.6.49
4.3.6.33
4.3.6.52
4.3.6.19
4.3.6.58
4.3.6.42
4.3.6.48
4.3.6.32
4.3.6.38
4.3.6.22
4.3.6.12
4.3.6.51
4.3.6.18
4.3.6.47
4.3.6.31
4.3.6.37
4.3.6.21
4.3.6.27
4.3.6.50
4.3.6.17
4.3.6.46
4.3.6.30
4.3.6.36
4.3.6.20
4.3.6.26
4.3.6.65
4.3.6.16
4.3.6.45
4.3.6.35
4.3.6.82
4.3.6.88
4.3.6.87
4.3.6.86
4.3.6.84
4.3.6.83
4.3.6.89
4.3.6.91
4.3.6.92
4.3.6.93
4.3.6.94
4.3.6.96
4.3.6.100
4.3.6.99
4.3.6.102
4.3.6.103

someone please help me in sorting the above I/P. I used sort -n, but it doesn't work properly.

Please also explain how the command or option works there.

sed 's/\./ /g' input.txt | sort -n -k 4 | sed 's/ /./g'
sort -t'.' -nk4 infile

--ahamed

Thanks Ahamed. It helped... :slight_smile:

GNU sort has -V option for sorting versions.

sort -nt. -k1.1 -k2.2 -k3.3 -k4.4 infile