Skip to content

Instantly share code, notes, and snippets.

@allex
Created July 1, 2011 03:14
Show Gist options
  • Save allex/1057802 to your computer and use it in GitHub Desktop.
Save allex/1057802 to your computer and use it in GitHub Desktop.
Counting linux source code
find . -name \*.h -exec wc {} \; > /tmp/src.txt
find . -name \*.c -exec wc {} \; >> /tmp/src.txt
cat sample.py
total = 0
myfile = open('src.txt')
lines = myfile.readlines()
for line in lines:
print line.split()[0]
total += int(line.split()[0])
print total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment