On jeu, 04 oct 2012 06:49:10 +0200, Jim Meyering wrote: > > I am getting some strange output from cmp on two files. The index is off by > > one > > for the first and last difference, and both the index and values are wrong > > for > > the second difference. I tried two versions of cmp (listed below), and I > > got the > > same output in both cases. My system info is also displayed below. > ... > > Thanks for the report, but I don't see a problem. > The index is 1-based, not zero-based. > The values are printed in octal, so 16,13 match the 0e,0b > in your hexdump output.
Oops... Octal ?!
Maybe that's why I never understood the output of cmp... ^_^
> > $ cmp -l file1 file2
> > 10 2 4
> > 64 16 13
> > 200 4 2
> >
> > $ cmp -l file1 file2 | awk '{printf("%x %x %x\n",$1,$2,$3)}'
> > a 2 4
> > 40 10 d
> > c8 4 2
> >
> > $ hexdump file1
> > 0000000 0c 00 00 00 00 00 00 00 01 02 00 07 0a 00 0b 0a
> > 0000010 1f 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 0000020 00 00 00 00 00 00 00 00 00 10 00 00 00 08 00 00
> > 0000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0e
> > 0000040 00 10 08 08 04 03 20 04 40 00 40 00 00 00 14 00
> > 0000050 02 01 00 03 05 08 00 00 00 00 ff ff ff ff 01 03
> > 0000060 02 07 ff ff ff ff 01 00 00 00 00 03 02 00 ff ff
> > 0000070 ff ff 01 00 00 00 00 03 02 00 ff ff ff ff 01 00
> > 0000080 00 00 00 03 02 00 ff ff ff ff 01 00 00 00 00 03
> > 0000090 02 00 ff ff ff ff 01 00 00 00 00 03 02 00 ff ff
> > 00000a0 ff ff 01 00 00 00 00 03 02 00 00 00 00 00 00 00
> > 00000b0 00 00 00 00 00 00 01 00 1e 00 00 00 04 00 00 00
> > 00000c0 03 07 00 00 00 00 00 04 00 00 00 00 00 00 00 00
> > 00000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > *
> > 0000200
> >
> > $ hexdump file2
> > 0000000 0c 00 00 00 00 00 00 00 01 04 00 07 0a 00 0b 0a
> > 0000010 1f 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 0000020 00 00 00 00 00 00 00 00 00 10 00 00 00 08 00 00
> > 0000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0b
> > 0000040 00 10 08 08 04 03 20 04 40 00 40 00 00 00 14 00
> > 0000050 02 01 00 03 05 08 00 00 00 00 ff ff ff ff 01 03
> > 0000060 02 07 ff ff ff ff 01 00 00 00 00 03 02 00 ff ff
> > 0000070 ff ff 01 00 00 00 00 03 02 00 ff ff ff ff 01 00
> > 0000080 00 00 00 03 02 00 ff ff ff ff 01 00 00 00 00 03
> > 0000090 02 00 ff ff ff ff 01 00 00 00 00 03 02 00 ff ff
> > 00000a0 ff ff 01 00 00 00 00 03 02 00 00 00 00 00 00 00
> > 00000b0 00 00 00 00 00 00 01 00 1e 00 00 00 04 00 00 00
> > 00000c0 03 07 00 00 00 00 00 02 00 00 00 00 00 00 00 00
> > 00000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > *
> > 0000200
> ...
> > $ /opt/local/libexec/gnubin/cmp --version
> > cmp (GNU diffutils) 3.2
>
--
Eric Deplagne
signature.asc
Description: Digital signature
