summaryrefslogtreecommitdiff
path: root/renumptr.sh
diff options
context:
space:
mode:
Diffstat (limited to 'renumptr.sh')
-rwxr-xr-xrenumptr.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/renumptr.sh b/renumptr.sh
new file mode 100755
index 0000000..cceb45a
--- /dev/null
+++ b/renumptr.sh
@@ -0,0 +1,17 @@
1#!/bin/bash
2
3IN=$1
4OUT=$2
5
6EXPR="s@00000000@null@g\n"
7CNT=1
8for PTR in $(grep -o -E -e '[0-9A-F]{8}' $IN | sort | uniq | grep -v 00000000); do
9 EXPR="${EXPR}s@${PTR}@$(printf %4d ${CNT})@g\n"
10 CNT=$(($CNT+1))
11done
12
13temp=$(mktemp)
14echo -e "$EXPR" > $temp
15sed -f $temp $IN > $OUT
16rm $temp
17