Tuesday, March 02, 2010

5831

It's after midnight and I'm still at work... TimeSpace2 is close to launching and the whole team is sitting here tapping away on the keyboard. I wrote a nice little script to count all the lines I've written in Python for this project so far... 5831

Here's script to do that if anyone is interested...

find /data/washingtonpost/timespace -path '/data/washingtonpost/timespace/lib' -prune -o -name '*.py' -exec wc -l {} \; | awk '{count+=$1} END {print count}'

That will look in the first directory specified, /data/washingtonpost/timespace in my case and will ignore anything in the second directory, which is my python lib and all code I didn't write. Then we pass the or switch, tell it to match files ending in .py and execute word count to count the lines in the file. That then get's piped over to awk where we grab the first field and keep track of those values in a variable and when the program ends print the count. Probably other ways to do that but this one works for me.

I had every intention of blogging before a week passed by but it didn't happen.

No comments: