Project

General

Profile

Bug #52294 ยป find-exception-duplicates.sh

Christian Kuhn, 2013-09-26 13:55

 
#!/bin/bash

EXCEPTIONS=`ack-grep --type php 'throw new' -A5 | grep '[[:digit:]]\{10\}'`

DUPLICATES=`echo $EXCEPTIONS |
awk '{
for(i=1; i<=NF; i++) {
tmp=match($i, /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/);
if(tmp) {
print $i
}
}
}' | cut -d';' -f1 | tr -cd '0-9\012' | sort | uniq -d`

for CODE in $DUPLICATES; do
echo "Possible duplicate exception code $CODE"
ack-grep --type php $CODE
echo
echo
done
    (1-1/1)