[TUHS] Command options and complexity

Steffen Nurpmeso steffen at sdaoden.eu
Sat Mar 14 05:48:18 AEST 2020


Doug McIlroy wrote in
<202003130304.02D343ok099975 at 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)


More information about the TUHS mailing list