aboutsummaryrefslogtreecommitdiff
path: root/renumptr.sh
blob: cceb45ad7364388104e435a0615d0101bd058a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

IN=$1
OUT=$2

EXPR="s@00000000@null@g\n"
CNT=1
for PTR in $(grep -o -E -e '[0-9A-F]{8}' $IN | sort | uniq | grep -v 00000000); do
	EXPR="${EXPR}s@${PTR}@$(printf %4d ${CNT})@g\n"
	CNT=$(($CNT+1))
done

temp=$(mktemp)
echo -e "$EXPR" > $temp
sed -f $temp $IN > $OUT
rm $temp