[SunHELP] serious problems with understanding the 'sort' command
Solaris Neophyte
solarisneophyte at yahoo.com
Thu Mar 14 18:22:02 CST 2002
i have been trying to understand this chapter titled "Searching for Files and
Text" for a few weeks now.
unfortunately, this chapter is one of those things, that no matter how hard you
try and how long you try for, you are incapable of understanding (at least in
my case)
this entire chapter, grep and it's derivatives and the sort command have been
extremely frustrating.
i am hung up on the sort command more so than the others, but there are certain
features that are especially difficult to understand.
this is what the book says about the sort command:
sort -options filenames(s)
the following two options are killing me:
-n performs a numeric sort.
(+|-)n begins (+n) or ends (-n) the sort with the field following the n
field
consider the following two examples, that have 8 columns (do columns=fields ?):
sort -rn +4 list -o num.list
sort -rn -3 list -o num2.list
sort +5n list -o update.list
first i would like some clarification with the (+|-)n option.
in the first example, the +4 says that we start counting from the 5th field
(5th field because we start counting from 0, not 1 right?)... so when we count,
we use fields 5,6,7 right?
in the second example, the -3 says we start counting from the 4th field
backwards right? so 3,2,1,0?
next, i'm confused with what I see with the first two examples and the last. I
notice that in the first two examples the +/- numbers (+4 and -3) are isolated
options, but in the last example, +5n, the two options I mentioned earlier are
combined. I don't understand why this is done, or what it means. shouldn't it
be +5 -n instead of +5n? is +5 -n different from +5n?
can anyone please help reduce my confusion with this command?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
More information about the SunHELP
mailing list