[Linux-users] Sort Question
Ben Duncan
linux4ms
Sat Aug 4 06:29:14 PDT 2007
Actually, you can use several of the SORT options:
sort -t? +xn
Where -t? is the "delimter" to use , so if you want to break the
sort apart by colons, it would be -t:
and +xn is which fields you want to use so if you want to sort
by the second and fifth fields, use
sort +2n +5n -t:
which says sort on the second by NUMERIC and the fifth by numeric.
Now if you wanted to sort the second ALPHA and the fifth numeric,
use:
sort +2 +5n -t:
Hope this helps ...
sean at csupport.com wrote:
> The sort command sorts lines of text. So, in your example, it is doing
> exactly what you told it to do. You need to break each line into its
> parts and sort that. Try something like:
>
>
<SNIP>
--
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
- Hanlon's Razor
More information about the Linux-users
mailing list