1#! /bin/sh 2# Feed log in stdin (sometimes 'grep' to get interesting parts) 3 4print_hex() 5{ 6 hex="$1" 7 # We allow one character of trailing junk 8 while [ ${#hex} -gt 1 ]; do 9 /usr/bin/printf \\x$(echo "$hex" | cut -c1,2) 10 hex=$(echo "$hex" | cut -c3-) 11 done 12} 13 14while read TIMESTAMP LOGDIR HEX; do 15 case "$LOGDIR" in 16 *\[IN\]|*\[OUT\]) 17 echo $LOGDIR:$(print_hex "$HEX") 18 ;; 19 esac 20done 21