Date: Thu, 14 Mar 2002 16:20:03 -0800 (PST) From: Bsd Neophyte <bsdneophyte@yahoo.com> To: freebsd-questions@freebsd.org Subject: serious problems with understanding the 'sort' command Message-ID: <20020315002003.94109.qmail@web20105.mail.yahoo.com>
next in thread | raw e-mail | index | archive | help
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? __________________________________________________ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020315002003.94109.qmail>