[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sort - specifying sort fields/keys.
From: |
cga2000 |
Subject: |
sort - specifying sort fields/keys. |
Date: |
Tue, 08 Apr 2008 00:45:59 -0400 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
I use the following on debian etch:
$ 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.
I wanted to sort the output of the ls command by filename and with
directories first and regular files last.
What I came up with does not quite behave as I expected:
$ cd ~/.vim
$ ls -al --color=never | sort -k1.1,1.1r -k8f
.. and this is what I get:
total 392
drwxr-xr-x 13 gavron gavron 4096 2008-04-08 00:11 .
drwxr-xr-x 46 gavron gavron 4096 2008-04-08 00:02 ..
drwxr-xr-x 2 gavron gavron 12288 2007-07-08 12:42 colors
drwxrwxr-x 2 gavron gavron 4096 2008-02-17 14:39 doc
drwxr-xr-x 2 gavron gavron 4096 2006-05-30 00:08 ftdetect
drwxr-xr-x 2 gavron gavron 4096 2007-03-09 18:32 ftplugin
drwxr-xr-x 2 gavron gavron 4096 2007-05-28 12:46 keymap
drwxrwxr-x 3 gavron gavron 4096 2007-04-28 12:43 macros
drwxr-xr-x 2 gavron gavron 4096 2008-02-10 16:58 plugin
drwxr-xr-x 2 gavron gavron 4096 2007-10-05 20:50 spell
drwxrwxr-x 2 gavron gavron 4096 2007-07-08 10:28 syntax
drwxr-xr-x 2 gavron gavron 4096 2007-07-08 10:28 tmp
drwxr-xr-x 5 gavron gavron 4096 2005-02-21 22:20 vim2ansi
-rw-r--r-- 1 gavron gavron 2879 2007-03-25 14:59 .clewn_keys
-rw-r--r-- 1 gavron gavron 1416 2007-03-25 14:59 clewn.vim
-rw-r--r-- 1 gavron gavron 166873 2006-04-09 03:16 ColorSamplerPack.zip
-rw-r--r-- 1 gavron gavron 0 2008-04-08 00:16 efile
-rw-r--r-- 1 gavron gavron 0 2008-04-08 00:16 Efile
-rw-r--r-- 1 gavron gavron 0 2008-04-08 00:11 .efile
-rw-r--r-- 1 gavron gavron 11392 2006-04-12 21:35 manpageview.tar.gz
-rw-r--r-- 1 gavron gavron 13645 2006-06-04 18:02 prtdialog.zip
-rw-r--r-- 1 gavron gavron 123628 2006-06-11 03:45 ttcoach.zip
All fine and dandy except for one little detail:
Why does .efile appear together with my other two [Ee]file's rather than
just below .clewn_keys?
Looks like sort is ignoring the dots .. ??
Side-effect of the "f" flag specified with my second sort key ..?
Something to do with my locale (en_US)?
Thanks!
- sort - specifying sort fields/keys.,
cga2000 <=
- Re: sort - specifying sort fields/keys., Bob Proulx, 2008/04/08
- Re: sort - specifying sort fields/keys., cga2000, 2008/04/08
- Re: sort - specifying sort fields/keys., Bob Proulx, 2008/04/08
- Re: sort - specifying sort fields/keys., cga2000, 2008/04/09
- Re: sort - specifying sort fields/keys., Bob Proulx, 2008/04/09
- Re: sort - specifying sort fields/keys., cga2000, 2008/04/12
- Re: sort - specifying sort fields/keys., Bob Proulx, 2008/04/13