[Gllug] Stories of using filters

Richard Cohen vmlinuz at gmail.com
Sat Mar 19 00:55:39 UTC 2005


On Fri, 18 Mar 2005 18:06:08 +0000, Tethys <tet at createservices.com> wrote:
> 
> Nix writes:
> 
> >> od
> >
> >Whenever you want to see WTF is going on with some binary file :)
> 
> Yes, although I've always ended up writing my own so that a) it uses hex
> not octal -- od can do this for the data, but not the offset, and b) it
> gives an ascii representation at the side, in the one true (BBC micro)
> format:
> 
>   isengard:~% dd if=map.png bs=75 count=1 2>/dev/null | hd
>   00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  .PNG........IHDR
>   00000010  00 00 02 17 00 00 03 00  04 03 00 00 00 65 53 58  .............eSX
>   00000020  ec 00 00 00 04 67 41 4d  41 00 00 b1 8f 0b fc 61  .....gAMA......a
>   00000030  05 00 00 00 18 50 4c 54  45 0c 09 09 3d 37 38 69  .....PLTE...=78i
>   00000040  6a 72 ae ae ae c3 c2 c2  d5 d4 d4                 jr.........

Is there any particular reason not to just use xxd for this?  xxd
being part of vim, as exuberant ctags was until a few years ago:

richardc$ xxd to_levi_eshkol_street.pdf | head -n5 
0000000: 2550 4446 2d31 2e34 0d25 e2e3 cfd3 0d0a  %PDF-1.4.%......
0000010: 3620 3020 6f62 6a3c 3c2f 485b 3539 3620  6 0 obj<</H[596 
0000020: 3135 375d 2f4c 696e 6561 7269 7a65 6420  157]/Linearized 
0000030: 312f 4520 3833 3539 362f 4c20 3837 3537  1/E 83596/L 8757
0000040: 312f 4e20 312f 4f20 392f 5420 3837 3430  1/N 1/O 9/T 8740

If you want it to dump 8-bit values rather than 16-bit ones, the -g
option will do the job...
[snip]

> Tet

Cheers
Richard
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list