* add function hexcmp: compare two binary files and show differences
authormitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Thu, 7 Mar 2013 16:14:51 +0000 (16:14 +0000)
committermitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Thu, 7 Mar 2013 16:14:51 +0000 (16:14 +0000)
  * code from http://superuser.com/questions/125376/how-do-i-compare-binary-files-in-linux

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@200 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

TipAndDoc/.bashrc

index 4b743ec..359a7a9 100644 (file)
@@ -42,6 +42,10 @@ function svnst {
     svn st $@ | grep "^[^?]"
 }
 
+function hexcmp {
+    cmp -l $@ | awk '{printf "%08X %02X %02X\n", $1-1, strtonum(0$2), strtonum(0$3)}'
+}
+
 alias vi='vim'
 alias sudo='sudo -H '
 alias rm='rm -v'