[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Trying to get sort keys to work
From: |
mario |
Subject: |
Trying to get sort keys to work |
Date: |
Fri, 26 Oct 2007 09:47:56 -0700 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20070728) |
Hi -
One of the biggest frustrations with the "sort" utility is figuring out how to
tell it where exactly the keys are on each line. For example, I have a file which
contains, in part,
MI#4617 ROM11 FAD_13 vss! vss! nmos L=0.18U W=0.69U
MI#4765 ROM0N FAD_11 vss! vss! nmos L=0.18U W=0.69U
MI#4749 ROM8N FAD_15 vss! vss! nmos L=0.18U W=0.69U
I really want to sort FIRST on column 3, and then on the numeric part of column
2. I would think that the sort command would be something like
sort -s -k3 -k2.4n
BUT this doesn't work. It sorts OK on column 3, but then does nothing with the
second sort key.
It would be incredibly useful if there were some mode in which sort would just
report each line and the sort keys found on that line, so that I can make sure
that I'm properly communicating how to find the darn keys!
-- Mario
% sort --version
sort (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and Paul Eggert.
- Trying to get sort keys to work,
mario <=