Skip to content

Instantly share code, notes, and snippets.

@ke4qqq
Created January 10, 2014 16:53

Revisions

  1. ke4qqq created this gist Jan 10, 2014.
    18 changes: 18 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/sh
    declare -A map
    while read line; do
    if grep "^[a-zA-Z]" <<< "$line" > /dev/null; then
    current="$line"
    if [ -z "${map[$current]}" ]; then
    map[$current]=0
    fi
    elif grep "^[0-9]" <<<"$line" >/dev/null; then
    for i in $(cut -f 1,2 <<< "$line"); do
    map[$current]=$((map[$current] + $i))
    done
    fi
    done <<< "$(git log --numstat -w -b --no-merges --after={2013-01-01} --before={2013-12-31} --pretty="%aN")"

    for i in "${!map[@]}"; do
    echo -e "$i:${map[$i]}"
    done | sort -nr -t ":" -k 2 | column -t -s ":"