Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Mar 2002 15:03:44 +0000
From:      Wes Peters <wes@softweyr.com>
To:        Nate Williams <nate@yogotech.com>
Cc:        Alfred Perlstein <bright@mu.org>, arch@FreeBSD.ORG
Subject:   Re: Sorting and Matching options for ls(1)
Message-ID:  <3C862FD0.3040100@softweyr.com>
References:  <3C862030.9080108@softweyr.com>	<20020306201842.GS77980@elvis.mu.org> <15494.32446.840336.843194@caddis.yogotech.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Nate Williams wrote:
> Alfred Perlstein writes:
> 
>>* Wes Peters <wes@softweyr.com> [020306 12:05] wrote:
>>
>>>At the request of several FreeBSD users, I have developed the following
>>>two options for ls(1):
>>>
>>>     -M      Display files that match the specified types only.  The file
>>>             types are specified by a single character as in strmode(3), 
>>>             with
>>>             the option to specify regular files as ``r'' instead of ``-'' 
>>>             if
>>>             needed.
>>>
>>>     -S      Explicity specify the sorting order.  The sorting flags are:
>>>
>>EXAMPLES
>>     The following is how to do an ls listing sorted by size (and shows why ls
>>     does not need a separate option for this):
>>
>>           ls -l | sort -n +4
>>
> 
> Or, alternatively.
> 
>     ls -ls | sort
> 
> And in reverse order
> 
>     ls -ls | sort -r

Now make it do one (or either) and only display the filenames:

bash-2.05$ ./ls -Ss /bin
tcsh            unlink          cp              test            sleep
csh             rm              chmod           mkdir           echo
sh              mv              cat             kill            rmail
ls              red             df              link            sync
pax             ed              chio            ln
rcp             expr            realpath        hostname
ps              dd              pwd             domainname
date            stty            [               rmdir


I made all the same arguments to the users who adamantly requested both,
and was told resoundingly that resorting to a pipe with combinations of
grep, sort, and awk was not acceptable.  You could at least assume I know
how to read a man page, and use sort and grep.

Anyone else who want to raise the trivial argument "ls already has too
many options" can simply reply directly to me with a subject of "ls:
trivial argument".  Spare the list traffic.

-- 
             "Where am I, and what am I doing in this handbasket?"

Wes Peters                                                         Softweyr LLC
wes@softweyr.com                                           http://softweyr.com/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C862FD0.3040100>