Hi,
I have a file with the following contents:
Quote:
20100228062520 10.134.53.113
20100228062520 10.134.53.114
20100228062520 10.134.53.114
20100228062520 99.247.216.111
20100228062521 10.134.53.111
20100228062521 10.134.53.114
20100228062522 201.230.227.197
20100228062524 99.247.216.111
20100228062525 10.134.53.114
20100228062525 99.247.216.110
|
The columns are separated by a TAB.
I want to sort by the IP address and i do this:
Code:
cat file2.txt | sort -n -k2,2 -t " " | less
But the output isn't quite correct. It seems that it sorts only by the 1st IP number (before the first point).
Quote:
20100228062520 10.134.53.113
20100228062520 10.134.53.114
20100228062520 10.134.53.114
20100228062521 10.134.53.111
20100228062521 10.134.53.114
20100228062525 10.134.53.114
20100228062520 99.247.216.111
20100228062524 99.247.216.111
20100228062525 99.247.216.110
20100228062522 201.230.227.197
|
If i cut only the IPs i get the correct result
Code:
cat file2.txt | cut -d " " -f2,2 | sort -n
Quote:
10.134.53.111
10.134.53.113
10.134.53.114
10.134.53.114
10.134.53.114
10.134.53.114
99.247.216.110
99.247.216.111
99.247.216.111
201.230.227.197
|
Can someone explain to me why this happen?