diffcmd

Mon, 29 May 2006 18:05:52 +0000
tech code

I do a lot of hacking with binary files at work, and simply doing a diff to check if two files are the same isn't really useful, I usually want to preprocess the file with some command to make it into useful plain text. This ends up being quite tedious by hand. I came up with this simple script, diffcmd, but I'm sure the lazyweb will let me know of anything better if it exists.

Usage: % diffcmd "readelf -a" file1 file2

#!/bin/sh

CMD=$1
FILE1=$2
FILE2=$3
TMP1=`tempfile`
TMP2=`tempfile`
$CMD $FILE1 > $TMP1
$CMD $FILE2 > $TMP2

diff -u $TMP1 $TMP2

rm $TMP1 $TMP2
blog comments powered by Disqus