Simple CLI one-liner for line counts Fri, 29 Feb 2008 22:11:59 -0500

Here is a little tip about how to perform a quick line count recursively through your code.

c=0; for i in `find . -type f -name "*.php"`; do c=$(( $c + `wc -l $i | cut -d ' ' -f 1`)); echo $c; done; echo $c

THis example is specifically for searching out PHP scripts, however you can modify this however you like to fine what files you want.


  • About The Author
  • This is the definitive blog for the musings of Brian Smith. I've been a programmer / sys admin for most of my life. I don't have much to say, I work, I enjoy my family, and every once in awhile I'll dump a little something I want to keep track of here.

    Currently I am the CTO of DNS.com where we provide geolocation based authoritative DNS services for the masses. I also have been working on drafts that are submitted to the IETF to the dnsext working group.

    In the past I have been involved with organizing various user groups, including an off and on again 2600 group. Also I have been involved with the development of Seclude, an open source secure instant messaging platform as well as Sliker, a project that later developed into plasma for the KDE desktop environment.

    Additionally I am an avid home brewer making my own beer. Everything else should be below or to the left.

  • Disclaimer
  • The ideas and opinions expressed here are mine.
  • I'm a Linux and BSD user, and lean heavily toward the use of OSS vs certain other commercial solutions.

:= RSS =: