From owner-freebsd-questions Fri Jan 5 03:35:16 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id DAA01353 for questions-outgoing; Fri, 5 Jan 1996 03:35:16 -0800 (PST) Received: from eac.iafrica.com (slipper119235.iafrica.com [196.7.119.235]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id DAA01346 for ; Fri, 5 Jan 1996 03:35:09 -0800 (PST) Received: (from rnordier@localhost) by eac.iafrica.com (8.6.12/8.6.12) id NAA00709; Fri, 5 Jan 1996 13:33:10 +0200 From: Robert Nordier Message-Id: <199601051133.NAA00709@eac.iafrica.com> Subject: Re: sorting by character position To: brian@MediaCity.com (Brian Litzinger) Date: Fri, 5 Jan 1996 13:33:08 +0200 (SAT) Cc: questions@freebsd.org In-Reply-To: <199601050708.XAA05741@MediaCity.com> from "Brian Litzinger" at Jan 4, 96 11:08:28 pm X-Mailer: ELM [version 2.4 PL24 ME8a] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org Precedence: bulk Brian Litzinger wrote on 4 Jan 1996: > > > > > All I want to do is > > > > > > sort -n -d -k 14,29 sorted > > > > > > where -k 14,29 is supposed to mean that sort is supposed to consider > > > the data in columns 14 - 29 of each line as the key to sort by. > > I tried several test files and just couldn't quite get what I wanted > which was: > > forbar flem ickto $1234588 gort sneakers flem > ^^^^^^^^^^^ > and I'd liked to sort on the columns indicated. Unless I've misunderstood, something like this is probably what you want: [unsorted file] fifte 1111 fourt 1110 thirt 1101 twelv 1100 eleve 1011 ten 1010 nine 1001 eight 1000 seven 111 six 110 five 101 four 100 three 11 two 10 one 1 zero 0 sort -t: +0.6 -0.9 test one 1 zero 0 three 11 two 10 five 101 four 100 seven 111 six 110 eight 1000 nine 1001 eleve 1011 ten 1010 thirt 1101 twelv 1100 fifte 1111 fourt 1110 ^^^ sorted on 6..8 -- Robert Nordier rnordier@iafrica.com E.A.C.