the major.minor.build numbers can be any magnitude. How does sort -k deal with things like this? So the output should be the same text but ordered numerically by major.minor.build.
Hello aigles,
Could you elaborate that the option of sort -k?
I mean in your two solutions, the first one used -k1.9 and the second one used the -k1,1, are there any difference between them? I can't sort the file using -k1,9 in the first example.
And In the manual of sort, the option K should take the comma not the dot.
-k keydef The keydef argument defines a restricted sort key.
The format of this definition is
field_start[type][,field_end[type]]
...
A field_start position specified by m.n is
interpreted to mean the nth character in the mth
field.
...
strange i'm using sort 6.9 on mandriva 2008 and this doesnt appear in the man pages:
[server~]$ sort --version
sort (GNU coreutils) 6.9
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <The GNU General Public License - GNU Project - Free Software Foundation (FSF)>.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and Paul Eggert.
POS is F[.C][OPTS], where F is the field number and C the character position in the field; both are
origin 1. If neither -t nor -b is in effect, characters in a field are counted from the beginning of
the preceding whitespace. OPTS is one or more single-letter ordering options, which override global
ordering options for that key. If no key is given, use the entire line as the key.