The first block of code below is an example of how I want my output to look like when I run my hexdump command in C. Atm, I don't know how to get the 3 columns of double spaces and I don't know how to add the ASCII representation and "." for non-ASCII of the bytes on the right.
hexdump -C /etc/passwd
00000000 72 6f 6f 74 3a 78 3a 30 3a 30 3a 72 6f 6f 74 3a |root:x:0:0:root:|
00000010 2f 72 6f 6f 74 3a 2f 62 69 6e 2f 62 61 73 68 0a |/root:/bin/bash.|
00000020 64 61 65 6d 6f 6e 3a 78 3a 31 3a 31 3a 64 61 65 |daemon:x:1:1:dae|
00000030 6d 6f 6e 3a 2f 75 73 72 2f 73 62 69 6e 3a 2f 62 |mon:/usr/sbin:/b|
00000040 69 6e 2f 73 68 0a 62 69 6e 3a 78 3a 32 3a 32 3a |in/sh.bin:x:2:2:|
00000050 62 69 6e 3a 2f 62 69 6e 3a 2f 62 69 6e 2f 73 68 |bin:/bin:/bin/sh|
This is my actual output:
00000000 2f 2a 20 68 65 6c 6c 6f 2e 63 20 2a 2f a. a. 23
00000010 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68
00000020 3e a. a. 69 6e 74 20 6d 61 69 6e 28 69 6e 74 20
00000030 61 72 67 63 2c 20 63 68 61 72 20 2a 61 72 67 76
00000040 5b 5d 29 a. 7b a. 20 20 70 75 74 73 28 22 48 65
00000050 6c 6c 6f 20 77 6f 72 6c 64 21 5c 6e 22 29 3b a.
00000060 20 20 72 65 74 75 72 6e 20 30 3b a. 7d a.
0000006e
thanks