LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to count line numbers recursively in a directory? (https://www.linuxquestions.org/questions/linux-general-1/how-to-count-line-numbers-recursively-in-a-directory-199899/)

puzz_1 07-01-2004 09:38 AM

How to count line numbers recursively in a directory?
 
HOw do i get the total line count in ALL the files in a particular diretory recursively?

I tried

cat * | wc -l

somehow this doesn't go into subdiretories and it doesn't ignore non-text files.

acid_kewpie 07-01-2004 09:43 AM

Quote:

somehow this doesn't go into subdiretories and it doesn't ignore non-text files.
So this Somehow...

1) cat it a non recursive program...

2) cat doesn't distinguish between ascii and binary files. why should it?

you would want to possibly do a find on that directory (which IS recursive) and then use those results as the input to a for loop, which would include a 'test' command to check what kind of file it is.


All times are GMT -5. The time now is 08:52 PM.