All pastes #931099 Raw Edit

cripy

public shellscript v1 · immutable
·published 2008-03-06 23:20 UTC
rendered paste body
#!/bin/sh#grep status.#change grep line to your own grep, make sure to have '-n' flag.        LINE_COUNT=`wc -l 03_03-00.00.00_iplog.log|awk '{print $1}'`        grep -no 'to [^ :]*' 03_03-00.00.00_iplog.log|sed 's/[0-9]*:to //g' |sort|uniq &        GREP_PID=`ps auxwww|grep -e 'grep' -e 'grep 0:[0-9][0-9]' |grep -v 'grep -e grep' |awk '{print $2}'`        CUR_LINE=0;        P=`ps aux |awk '{print $2}' |grep $GREP_PID`        while [ "$P" != "" ]; do                CUR_LINE=`strace -s 40 -e trace=write -p $GREP_PID 2>&1|head -2|grep -oe "\n[0-9]*:" |sed "s/[n:]//g" |tail -1|tr "\n" ' '`                tput el                printf "\rline: $CUR_LINE of: $LINE_COUNT"                printf "| %s %% complete" `python -c "print repr($CUR_LINE*100/$LINE_COUNT.0)"`                P=`ps aux |awk '{print $2}' |grep $GREP_PID`        done;