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}
.
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}
.