-1

I know that this script: find . -name '*' | xargs wc -l will count all the lines of code recursively in a directory, however since I am using plugins, the script will count those too.

I just want to be able to count the lines of code that I have written. If I add a commented string to each file that I write, how will I modify that script so it only counts files containing that specific string (perhaps something like originalCode-01-NoPlugin-).

Thanks in advance.

mnm
  • 101
  • 11
  • 1
    How are __we__ supposed to know how many lines of code have __you__ written? – devnull Mar 15 '14 at 18:20
  • @devnull files that I write will contain the commented string `originalCode-01-NoPlugin-` is that what you mean? – mnm Mar 15 '14 at 18:21
  • 3
    You seem to be looking for `grep -rl 'originalCode-01-NoPlugin-' . | wc -l` – devnull Mar 15 '14 at 18:24
  • @devnull that just brings back the number of occurrences of the phrase, not the lines of code – mnm Mar 15 '14 at 18:29

1 Answers1

2

grep -rl 'originalCode-01-NoPlugin-' ./ | xargs wc -l does the trick, thanks for pointing me in the right direction @devnull

It first finds the files and then counts the lines of code.

mnm
  • 101
  • 11