Skip to content

Instantly share code, notes, and snippets.

@tzengyuxio
Created April 19, 2012 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzengyuxio/2417859 to your computer and use it in GitHub Desktop.
Save tzengyuxio/2417859 to your computer and use it in GitHub Desktop.
stats of octopress blogpost
#!/bin/bash
# start year and end year
SYEAR=2005
EYEAR=`date "+%Y"`
POSTPATH=~/github/octopress/source/_posts/
echo
echo "YEAR File # Word Count"
echo "=============================="
for (( i=$SYEAR; i<=$EYEAR; i=i+1 ))
do
NUMFILES=`ls -l $POSTPATH$i* 2> /dev/null | wc -l`
NUMWORDS=" 0"
test $NUMFILES != "0" && NUMWORDS=`wc -m $POSTPATH$i-* | tail -n 1 | sed 's/ total//'`
echo "$i $NUMFILES $NUMWORDS"
done
echo "=============================="
NUMFILES=`ls -1 $POSTPATH* | wc -l`
NUMWORDS=`wc -m $POSTPATH* | tail -n 1 | sed 's/ total//'`
echo "Total $NUMFILES $NUMWORDS"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment