#!/bin/sh

# print the sum of SLOC for a subset of a package.
# The subset is specified using a regular expression.

# To use, "cd" into the package data directory (with the "_outfile.dat" files),
# then specify as the first parameter the pattern defining the subset.

# E.G.:
# cd ../data/linux
# print_sum_subset 'BUILD\/linux\/drivers\/'
#
#  will show the SLOC total for the "drivers" directory & subdirs
#  of the "linux" data subdirectory.

echo -n "$1 "
grep -h "$1" *_outfile.dat | grep '^[1-9][0-9]* [^ ]' | print_sum

