Index | Thread | Search

From:
enh <enh@google.com>
Subject:
Re: dd commas
To:
Geoff Steckel <gwes@oat.com>
Cc:
tech@openbsd.org
Date:
Mon, 18 Nov 2024 16:28:51 -0500

Download raw body.

Thread
  • Geoff Steckel:

    dd commas

    • Stuart Henderson:

      dd commas

    • enh:

      dd commas

On Mon, Nov 18, 2024 at 3:35 PM Geoff Steckel <gwes@oat.com> wrote:

> On 11/18/24 14:50, Tobias Heider wrote:
> > On Mon, Nov 18, 2024 at 01:36:55PM GMT, joshua stein wrote:
> >> Maybe someone else will find this useful, but when I ^T dd and see
> >> output like 1257557196800, I have to highlight three digits at a
> >> time in my terminal for my brain to understand if it's at hundreds
> >> of gigabytes or in terabytes.
> > I have often wished it was human readable by default and print a more
> > reasonable unit than Bytes, but this is definitely a step in the right
> > direction.
> >
> >> Before:
> >>
> >>      11994+0 records in
> >>      11993+0 records out
> >>      1257557196800 bytes transferred in 5017.398 secs (250659198
> bytes/sec)
> >>
> >> After:
> >>
> >>      11994+0 records in
> >>      11993+0 records out
> >>      1,257,557,196,800 bytes transferred in 5017.398 secs (250,659,198
> bytes/sec)
> >>
> a) if this formatting is useful here, does it belong in a library?
>

there's the ' modifier to printf... whenever this kind of thing comes up
for Android i wonder about implementing that. it would also address mark
kettenis' i18n complaint[1], except the problem for me is that POSIX
explicitly says that the C/POSIX locale has _no_ group separator, making it
a no-op for Android which is always "C.utf-8"[2]. if openbsd has more
locale support (and mark kettenis' complaint implies so) than Android, this
might still be a useful direction for you though...

____
1. POSIX has no way to represent languages that have more complicated
schemes; india, say.
2. for apps we say "use Java or icu ... the C apis are broken as
designed"[1].


> b) the final printout from dd has been the same for a long time
>     some scripts may depend on reading # bytes
> c) turning the commas on or off might wander into LC_ land
>     or adding a switch to dd
>
> Geoff Steckel
>
>