Sample Header Ad - 728x90

With what letters does OD utility separate each byte things, according to POSIX?

1 vote
1 answer
81 views
On my Termux, for example, the following can be obtained: $ od -A n -t x1 /dev/urandom | head -n 2 e3 5d bf 57 fb 8b 63 06 4a 18 fe 28 73 8f 3e c0 9f 08 6b d4 2d 38 2c 68 3c 51 83 1e 71 7b 57 2b As you can see the values are separated with space character. SUSv2 says: > The input data is manipulated in blocks, …. Each input block will be written as transformed by each output type, one per written line, in the order that the output types were specified. If the input block size is larger than the number of bytes transformed by the output type, … the output from each of the transformations will be separated by one or more blank characters. I omitted some unnecesary parts by replacing with '…' on the quotation above. 2004 and 2018 editions of POSIX say same things as above. Does the specification mean that it is possible to separate each byte, word, or whatever with tabs, '\f', '\r' and any other [:blank:] (in BRE) things instead of spaces and LFs? PS. Actually I was thinking of the most efficient and fastest way to make each byte into each line, in range of POSIXism. At first I thought od -A n -t x1 -v | tr ABCDEF abcdef | tr -Cd abcdef0123456789\\n | fold -w 2 | grep . or somethig similar would be better. Then I found out the POSIX specification saying something questionable, as above. Also how about decimals: od -A n -t u1 -v | tr -Cs 0123456789- '[\n*]' | grep . is one way, but what about not using tr -C...? Would it make it faster? That is the purpose.
Asked by user451199
Feb 16, 2021, 10:52 AM
Last activity: Feb 22, 2021, 12:54 PM