From owner-freebsd-questions Thu Mar 14 16:20:31 2002 Delivered-To: freebsd-questions@freebsd.org Received: from web20105.mail.yahoo.com (web20105.mail.yahoo.com [216.136.226.42]) by hub.freebsd.org (Postfix) with SMTP id 5059837B431 for ; Thu, 14 Mar 2002 16:20:04 -0800 (PST) Message-ID: <20020315002003.94109.qmail@web20105.mail.yahoo.com> Received: from [63.193.147.188] by web20105.mail.yahoo.com via HTTP; Thu, 14 Mar 2002 16:20:03 PST Date: Thu, 14 Mar 2002 16:20:03 -0800 (PST) From: Bsd Neophyte Subject: serious problems with understanding the 'sort' command To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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