× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott Klement wrote:
As was pointed out /six days ago/, now... you could easily do this:

ls -al | sort +4 -r

This code will work on an Unix system I'm aware of.

to get the directory sorted the way you want it. Or, if you can't stand
typing that much, you could type this:

alias lsz="ls -al | sort +4 -r"

(You could put that into a script that's run when you start QShell so
you don't have to type it each time) now whenever you like, you can sort
by size by typing:

lsz

I really think this discussion is making a mountain out of a molehill.
It was a problem that was SOOOO easy to solve. I'm having a tough time
with this thread.

Scott: You're having a tough time with this thread? Let me try to
explain it one more time:

First, note that "ls -S' is supported on Linux and the BSD unixes. It
does not seem to be supported on the System V derived Unixes. Based on
relative popularity of the various Unix variants, I estimate that at
least 95% of Unix systems (including GNU) support "ls -S". (And I think
I'm being generous to the commercial Unixes.)

Scott, you know the history of Unix. You know how well the commercial
vendors got along. They all claimed Posix compatibility. But what really
matters is not compatibility to some standard, but rather
interoperability. Consider the story behind Samba. Jeremy Allison and
others on the Samba team have done one heck of a job in achieving
interoperability, in spite of roadblocks thrown up by vendors. (The
story of how Allison exposed the lies made by a MS executive while under
oath in a European court is legend!)

But back to Unix. While the commercial vendors worked in their own
separate niches, GNU and Linux came along and changed the rules of the
game. For the commercial vendors, claiming Posix compliance was no
longer good enough. They had to also add Linux compatibility (or
affinity) to their product summary sheets.

My point is simply that GNU has usurped Posix in terms of defining what
a "Unix" system is.

Second, (and I should have raised this point much earlier in this
thread) let's say you want to be compatible across all Unixes when
wanting to sort a directory by size. Sorry, but "ls -al | sort +4 -r"
doesn't cut it. The "+" option on sort is considered obsolete under
Posix, and doesn't work on GNU. The portable way to express what you
want is "ls -al |sort -k5,5 -rn".

Cheers! Hans


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.