Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jan 1996 13:33:08 +0200 (SAT)
From:      Robert Nordier <rnordier@iafrica.com>
To:        brian@MediaCity.com (Brian Litzinger)
Cc:        questions@freebsd.org
Subject:   Re: sorting by character position
Message-ID:  <199601051133.NAA00709@eac.iafrica.com>
In-Reply-To: <199601050708.XAA05741@MediaCity.com> from "Brian Litzinger" at Jan 4, 96 11:08:28 pm

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Brian Litzinger wrote on 4 Jan 1996:
> > 
> > > All I want to do is
> > > 
> > > sort -n -d -k 14,29 <unsorted >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.



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?199601051133.NAA00709>