The Unix Heritage Society mailing list
 help / color / Atom feed
* Re: [TUHS] Command options and complexity
@ 2020-03-13  3:04 Doug McIlroy
  2020-03-13  4:25 ` Greg 'groggy' Lehey
  2020-03-13 19:48 ` Steffen Nurpmeso
  0 siblings, 2 replies; 5+ messages in thread
From: Doug McIlroy @ 2020-03-13  3:04 UTC (permalink / raw)
  To: tuhs

> -,: Make the option standard: output numbers with commas every 3 digits

A terrible idea. Whatever ls outputs should be easy for other
programs to read, and few know how to read commafied numbers.
As others have mentioned, this is also a strong argument for
changing the output representation of dates.

I often do mailx -H | sort -t/ -k2nr to sort in reverse order of size--a
quick way to find the pay dirt when I want to shrink my mailbox.
This would never fly if the sizes had commas. (Well, I suppose I
could add sed s/,//g to the pipeline.)

Doug

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [TUHS] Command options and complexity
  2020-03-13  3:04 [TUHS] Command options and complexity Doug McIlroy
@ 2020-03-13  4:25 ` Greg 'groggy' Lehey
  2020-03-14  2:24   ` Greg A. Woods
  2020-03-13 19:48 ` Steffen Nurpmeso
  1 sibling, 1 reply; 5+ messages in thread
From: Greg 'groggy' Lehey @ 2020-03-13  4:25 UTC (permalink / raw)
  To: Doug McIlroy; +Cc: tuhs

[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]

On Thursday, 12 March 2020 at 23:04:03 -0400, Doug McIlroy wrote:
>> -,: Make the option standard: output numbers with commas every 3 digits
>
> A terrible idea.

Yes, of course.  I don't think any of us meant these ideas seriously.
Was this the only objection you had?

> I often do mailx -H | sort -t/ -k2nr to sort in reverse order of size--a
> quick way to find the pay dirt when I want to shrink my mailbox.
> This would never fly if the sizes had commas. (Well, I suppose I
> could add sed s/,//g to the pipeline.)

In fact, at least FreeBSD sort -n handles the numbers quite happily.
I've tried it with 4.4BSD sort, which with a little coaxing builds
under FreeBSD.  It doesn't: it apparently sees the , as a delimiter.

The real question is whether a comma is a valid character in an
integer.  There are arguments that it should be.

Greg
--
Sent from my desktop computer.
Finger grog@lemis.com for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed.  If your Microsoft mail program
reports problems, please read http://lemis.com/broken-MUA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [TUHS] Command options and complexity
  2020-03-13  3:04 [TUHS] Command options and complexity Doug McIlroy
  2020-03-13  4:25 ` Greg 'groggy' Lehey
@ 2020-03-13 19:48 ` Steffen Nurpmeso
  1 sibling, 0 replies; 5+ messages in thread
From: Steffen Nurpmeso @ 2020-03-13 19:48 UTC (permalink / raw)
  To: Doug McIlroy; +Cc: tuhs

Doug McIlroy wrote in
<202003130304.02D343ok099975@tahoe.cs.Dartmouth.EDU>:
 |> -,: Make the option standard: output numbers with commas every 3 digits
 |
 |A terrible idea. Whatever ls outputs should be easy for other
 |programs to read, and few know how to read commafied numbers.
 |As others have mentioned, this is also a strong argument for
 |changing the output representation of dates.
 |
 |I often do mailx -H | sort -t/ -k2nr to sort in reverse order of size--a
 |quick way to find the pay dirt when I want to shrink my mailbox.
 |This would never fly if the sizes had commas. (Well, I suppose I
 |could add sed s/,//g to the pipeline.)

It was not fully developed code why you need to do this with the
old mailx you use.  With v14.9.11 that is in Debian stable (it is
called s-nail there) and Ubuntu since "Disco Dingo" (i do not know
Ubuntu, but i seem to recall you said you were using it) that
becomes

  mailx -Sautosort=date -H [| tac]

for example.  But you could also use -L and do something like

  mailx -H -L '(larger 5000)'  # > 5000 bytes
  mailx -H -L '(before 1-Mar-2020)'
  mailx -H -L '(since 1-Mar-2020)'

or even go a batch approach (`search' == `from'):

  printf 'search "(before 1-Mar-2020)" # sh(1)ell quoting needed!
    move ` +elder # move the last selection to $folder/elder
    xit
  ' | mailx -Squiet -Snoheader

This can be improved further (-# batch mode, for example).
A lot of things are missing yet, however, these examples use IMAP
search expression syntax, a compile-time option.  No "regular"
approach to these things yet.

Anyway, that mailx is 4670 changesets ahead of what you use.  It
is unfortunately not the place, date and time to grouch about the
Debian punishment of small projects with fewest developers, the
latest release is 5554 ahead (and enters unstable; in testing
there is one that is 5204 changesets ahead).  These are _my_
changesets: with a Dr. Hipp Fossil versioning philosophie the
numbers could easily be doubled or tripled.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [TUHS] Command options and complexity
  2020-03-13  4:25 ` Greg 'groggy' Lehey
@ 2020-03-14  2:24   ` Greg A. Woods
  2020-03-14 13:08     ` Richard Salz
  0 siblings, 1 reply; 5+ messages in thread
From: Greg A. Woods @ 2020-03-14  2:24 UTC (permalink / raw)
  To: The Unix Heritage Society mailing list

[-- Attachment #1: Type: text/plain, Size: 570 bytes --]

At Fri, 13 Mar 2020 15:25:27 +1100, Greg 'groggy' Lehey <grog@lemis.com> wrote:
Subject: Re: [TUHS] Command options and complexity
>
> The real question is whether a comma is a valid character in an
> integer.  There are arguments that it should be.

It would make sense if scanf() had the equivalent flag to printf() to
make number printing and parsing at least potentially orthogonal.

--
					Greg A. Woods <gwoods@acm.org>

Kelowna, BC     +1 250 762-7675           RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>     Avoncote Farms <woods@avoncote.ca>

[-- Attachment #2: OpenPGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [TUHS] Command options and complexity
  2020-03-14  2:24   ` Greg A. Woods
@ 2020-03-14 13:08     ` Richard Salz
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Salz @ 2020-03-14 13:08 UTC (permalink / raw)
  To: The Unix Heritage Society mailing list

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

> It would make sense if scanf() had the equivalent flag to printf() to
> make number printing and parsing at least potentially orthogonal.
>

That is not an easy thing to do because of local (er, locale:)
conventions.  See
https://docs.oracle.com/cd/E19455-01/806-0169/overview-9/index.html for
examples.

Having a canonical input and output format, which is converted by filters
just before/after the human sees the numbers, seems the only way to make
this work globally.

[-- Attachment #2: Type: text/html, Size: 806 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13  3:04 [TUHS] Command options and complexity Doug McIlroy
2020-03-13  4:25 ` Greg 'groggy' Lehey
2020-03-14  2:24   ` Greg A. Woods
2020-03-14 13:08     ` Richard Salz
2020-03-13 19:48 ` Steffen Nurpmeso

The Unix Heritage Society mailing list

Archives are clonable: git clone --mirror http://inbox.vuxu.org/tuhs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.tuhs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git