Quantcast
Viewing latest article 1
Browse Latest Browse All 4

Answer by George Vasiliou for Count the occurrences of a string in a file

Just for the record, the all time classic awk:

awk '/\.java$/{++c}END{print "Total java files:" c}' file

If you want to print also those filenames you can change {++c} to {print;++c}.


Viewing latest article 1
Browse Latest Browse All 4

Trending Articles