Friday, January 29, 2010

count all files matching some weird spec and piping though grep and stuff

You could probably do all this with find, but piping though grep a) makes me happy and is exciting b) is a bit more flexible:

find . -atime +30 | grep somethinginfilename | xargs ls -l | awk '{print $5}' | awk 'BEGIN{n=0}{n += $1}END{print n/1024/1024/1024}'

No comments: