[TUHS] basic tools / Universal Unix

Steffen Nurpmeso steffen at sdaoden.eu
Fri Oct 20 00:32:06 AEST 2017


Doug McIlroy <doug at cs.dartmouth.edu> wrote:
 |>       sed *n l pathname
 |>
 |>   The latter also has the advantage that its output is
 |
 |>   unambiguous, whereas the output of historical cat *etv is not.
 |>
 |> But mind you, in preparation of this email i found a bug in
 |> Busybox sed(1) which simply echoes nothing for the above.
 |
 |I assume that * is a typo for - . If so, sed did just what
 |-n tells it to--no printing except as called for by p or P.

It seems to be a problem of (the PDF to text conversion and) the
musl C library environment used on this box:

  ?0[steffen at essex tmp]$ echo *e | s-hex
  00000000  e2 88 92 65 0a                                    |...e.|
  00000005
  ?0[steffen at essex tmp]$ echo *e | iconv -f utf8 -t ascii
  *e
  ?0[steffen at essex tmp]$ command -v iconv
  /usr/bin/iconv
  ?0[steffen at essex tmp]$ apk info --who-owns /usr/bin/iconv
  /usr/bin/iconv is owned by musl-utils-1.1.16-r22

And of course because of mailx's "set reply-in-same-charset"
ending up using US-ASCII.

 |And speaking of sed anticipating other tools, the inclusion
 |of "head" in v7 as a complement to "tail" was a close call
 |because head is subsumed by sed q.

The difference being that these can be implemented as shell script
wrappers around (modern) sed easily, whereas the -vet thing would
require painful awk scripting, by reading bytewise and string
comparing each of those bytes against a sprintf("%c",0.255) and
a tree of if conditions, without having tried it.
And then head and tail are self-describing, whereas -vet as
a modifier for file content c(onc)atenation i never had problems
with, but looking for that feature in a stream editor is more
obvious for the unaware.

 |Doug

Ju-hu!

--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