Hi guys, consider the code below and the resiluts below that.
(I am trying to do something with cygwin that only has 'od'.)
(I KNOW these are NOT arrays, just humour me here.)
Is it possible to do what 'hexdump' does in a single line with 'od' instead of having to add the line with 'echo' in it to produce the same output as that from 'hexdump' without the last whitespace?
(The last whitespace is not a problem.)
OSX 10.12.3, default bash terminal.
If anyone will know this site will have that person.
I am not at home at the moment so I can't give you my cygwin version. It IS the default install though on a Windows 10 machine and it only has 'od' . It does not have 'xxd' either...
And no I am not trying to re-invent the wheel but trying to obtain a fast proper array for cygwin's version of AudiioScope that works.
The method shown does work but does it in two lines where 'hexdump' does it all in one. I can leave as is, but I would prefer it if the two had a similar _dump_s within just the one line.
Not only that if it can be done then I will have learnt something...
Not sure I fully understand the request (or problem). Looking at the result of
I get a similar one with
The main difference being that hd's bytes are printed with a separating space while od's are right justified in a four- char field. All this may of course be version dependent.
Hi JM...
Apologies if this attaches itself to my previous post, I don't know how to separate them...
Well I feel an absolute idiot now. My Windows 10 machine has CygWin Version 2.6.1 and it does indeed have 'hexdump' but still not 'xxd'...
I checked my Windows 8.1 machine but forgot to get the version number of CygWin and that does NOT have 'hexdump' so unless people people have late versions of CygWin then effectively 'od' is all I have FTTB. So I will make a note to remove 'od' in the future...
I just wondered if I could condense the two lines into the one single 'od' command...
---------- Post updated at 05:16 PM ---------- Previous update was at 05:02 PM ----------
Hi RudiC...
Well after discovering my Windows 10 machine's CygWin has 'hexdump' I will eventually steer this way, but, I am creating AudioScope on Apple MBP and the BSD 'od' does not have the '-w[width]' option. However CygWin's 'od' does and seems to work, as I know the file length will always be fixed then this could be a real bonus.
Thanks a lot. I will experiment with this option...
The macOS Sierra BSD-based od doesn't have -w width, but in addition to -b (to print bytes in octal), you also have the standard -t x1j (to print bytes in hex), -t u1 (to print bytes as unsigned decimal), -t d1 (to print bytes as signed decimal), and -t o1 (a synonym for -b). For example:
produces the output: