Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[OpenBSD -current] Dokumentation zu od (was: [od] Mehrbytige Ausgaben)

0 views
Skip to first unread message

Marcel Logen

unread,
May 14, 2022, 6:23:24 PM5/14/22
to
Marcel Logen in de.test,de.comp.os.unix.shell:

>>Wozu man diese zweibytige Ausgabe braucht (gibt's ja auch in Hex),
>>ist mir allerdings ein Rätsel.
>>
>>| t20$ od -h dateioct
>>| 0000000 6934 ce3e bc0f 926e 69d3 2a6e 9980 dd4f
>>| 0000020 ccf9 4a3d 14c7 73a5 e97c 252d a723 d83d
>>| 0000040 d150 c505 25eb a6c3 f86a 3c97 a05b 6367
>>| 0000060 8bf9 c3a3 a64d 5c7a 007a d379 f5f4 db07
>>| 0000100 a550 1878 e1ad 79a7 7c5c f63f 444f c903
>>| 0000120 71a8 8344 6fc6 bca1 1037 2493 1c4d d934
>>| 0000140 2581 9eb0
>>| 0000144
>>
>>| t20$ od -t x1 dateioct
>>| 0000000 34 69 3e ce 0f bc 6e 92 d3 69 6e 2a 80 99 4f dd
>>| 0000020 f9 cc 3d 4a c7 14 a5 73 7c e9 2d 25 23 a7 3d d8
>>| 0000040 50 d1 05 c5 eb 25 c3 a6 6a f8 97 3c 5b a0 67 63
>>| 0000060 f9 8b a3 c3 4d a6 7a 5c 7a 00 79 d3 f4 f5 07 db
>>| 0000100 50 a5 78 18 ad e1 a7 79 5c 7c 3f f6 4f 44 03 c9
>>| 0000120 a8 71 44 83 c6 6f a1 bc 37 10 93 24 4d 1c 34 d9
>>| 0000140 81 25 b0 9e
>>| 0000144
>>
>>(Alles mit OpenBSD-od.)
>
>Diese mehrbytigen Ausgaben sind wahrscheinlich historisch bedingt,
>nehme ich mal an.

Bei meinen Tests fiel mir auf, daß die Dokumentation (man page) von
OpenBSD-od an zwei Stellen flacsh ist.

1. "-D" steht für "decimal", nicht "octal":

| -D Four-byte octal display. Display the input offset in octal,
| followed by four space-separated, ten column, space filled, four-
| byte units of input data, in octal, per line.
^^^^^
Das sieht man auch schon daran, daß im Output Neunen vorkommen:

| t20$ od -D dateioct
| 0000000 3460196660 2456730639 0711879123 3712981376
| 0000020 1245564153 1940198599 0623765884 3627919139
| 0000040 3305492816 2797807083 1016592490 1667735643
| 0000060 3282275321 1551541837 3547922554 3674732020
| 0000100 0410559824 2041045421 4131355740 3372434511
| 0000120 2202300840 3164696518 0613617719 3644070989
| 0000140 2662344065
| 0000144

Der "input offset" sollte dann wohl auch in dezimal sein.

Für "four-byte octal display" gibt es die Option "-O".

2. Angeblich ist "-b" das Default-Format:

| -b One-byte octal display. Display the input offset in octal,
| followed by sixteen space-separated, three column, zero-filled,
| bytes of input data, in octal, per line. This is the default
| output style if no other is selected.
^^^^^^^^^^^^^^^^^^^^^^^
Tatsächlich ist es so:

| t20$ od -b dateioct
| 0000000 064 151 076 316 017 274 156 222 323 151 156 052 200 231 117 335
| 0000020 371 314 075 112 307 024 245 163 174 351 055 045 043 247 075 330
| 0000040 120 321 005 305 353 045 303 246 152 370 227 074 133 240 147 143
| 0000060 371 213 243 303 115 246 172 134 172 000 171 323 364 365 007 333
| 0000100 120 245 170 030 255 341 247 171 134 174 077 366 117 104 003 311
| 0000120 250 161 104 203 306 157 241 274 067 020 223 044 115 034 064 331
| 0000140 201 045 260 236
| 0000144

| t20$ od -o dateioct
| 0000000 064464 147076 136017 111156 064723 025156 114600 156517
| 0000020 146371 045075 012307 071645 164574 022455 123443 154075
| 0000040 150520 142405 022753 123303 174152 036227 120133 061547
| 0000060 105771 141643 123115 056172 000172 151571 172764 155407
| 0000100 122520 014170 160655 074647 076134 173077 042117 144403
| 0000120 070650 101504 067706 136241 010067 022223 016115 154464
| 0000140 022601 117260
| 0000144

| t20$ od dateioct
| 0000000 064464 147076 136017 111156 064723 025156 114600 156517
| 0000020 146371 045075 012307 071645 164574 022455 123443 154075
| 0000040 150520 142405 022753 123303 174152 036227 120133 061547
| 0000060 105771 141643 123115 056172 000172 151571 172764 155407
| 0000100 122520 014170 160655 074647 076134 173077 042117 144403
| 0000120 070650 101504 067706 136241 010067 022223 016115 154464
| 0000140 022601 117260
| 0000144

Das Default-Format ist also ähnlich wie mit "-o".

Marcel is7t (618749)

F'up2 de.comp.os.unix.bsd
--
╭─────╮ ╭──────────╮ ╭────╮ ╭───────╮ ╭──╮ ╭──╮
──╯ ╭─╯ ╰────────╮ │ ╭──╮ ╰──╮ ╰─╯ ╰─╮ │ ╰────╯ ╰─
╭────╯ ╭───╮ ╭──╮ │ │ │ │ ╭───╮ │ ╭─────╯ ╭──╯
╰────────╯ ╰───╯ ╰───╯ ╰─╯ ╰─╯ ╰─╯ ╰───────╯ d78a12

Marcel Logen

unread,
May 15, 2022, 6:25:16 AM5/15/22
to
Marcel Logen in de.comp.os.unix.shell,de.comp.os.unix.bsd:

>Bei meinen Tests fiel mir auf, daß die Dokumentation (man page) von
>OpenBSD-od an zwei Stellen flacsh ist.
>
>1. "-D" steht für "decimal", nicht "octal":
>
>| -D Four-byte octal display. Display the input offset in octal,
>| followed by four space-separated, ten column, space filled, four-
~~~~~
Das stimmt offenbar auch nicht, denn es wird "zero filled", s. u.

Auch Zeile 127 von
<https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/hexdump/odsyntax.c?annotate=1.28>
mit dem "%010u" deutet darauf hin.

>| byte units of input data, in octal, per line.
> ^^^^^
>Das sieht man auch schon daran, daß im Output Neunen vorkommen:
>
>| t20$ od -D dateioct
>| 0000000 3460196660 2456730639 0711879123 3712981376
~
>| 0000020 1245564153 1940198599 0623765884 3627919139
>| 0000040 3305492816 2797807083 1016592490 1667735643
>| 0000060 3282275321 1551541837 3547922554 3674732020
>| 0000100 0410559824 2041045421 4131355740 3372434511
>| 0000120 2202300840 3164696518 0613617719 3644070989
>| 0000140 2662344065
>| 0000144
>
>Der "input offset" sollte dann wohl auch in dezimal sein.

AFAIS ist der immer oktal (außer natürlich, wenn man "-A" benutzt).

Marcel hr22 (584770)
--
╭────────╮ ╭─╮ ╭────╮ ╭──────╮ ╭──╮ ╭───╮ ╭─
╰──────╮ ╰──╮ │ ╰─╮ ╰─╮ ╰───╯ ╭─╯ │ ╰───╯ ╰──╯
╭─╮ │ ╰────╮ ╭───╯ ╰──╮ ╰───╮ ╰─╮ ╰────────╮
╭─╯ ╰───╯ ╰─────╯ ╰──────╯ ╰────────────╯004a29
0 new messages