I'm trying to figure out how many lines of code I have for files that end in *.pp
find . -name *.pp -type f | wc -l 39
I know that I have 39 files, how can I figure out how many lines of code those 39 files contain?
Try this version:
Here's an example using
I believe if you have more files than will fit on a single command line call to
What's wrong with using the
@spuder attempted to use
There are a few problems:
OP did not explain what the files were. There are a few possibilities, most more obscure than what appears in OP's profile.
Given that profile, the ".pp" suffix refers to Puppet files, which are essentially a metadata declaration in Ruby syntax. Those files can have comments (beginning with
The usual interpretation of lines of code ignores those. Whether you want physical lines of code (total lines ignoring comments and blank lines) or source lines of code (the number of statements) depends on how picky you want to be.
Puppet's syntax is more complicated than that (it also allows C-style comments and has quoted strings), but for the sake of example, here is a very simple filter that trims out
in contrast to unfiltered: