#!/bin/sh mod="packages/*" echo "package,files,comments,sloc" > cloc.csv for m in $mod; do echo "$m"; echo "$m,`cloc $m/src --csv | grep "TypeScript" | cut -d ',' -f1 -f4-5`" >> cloc.csv; done echo "---\n:" awk -F ',' '{ files+=$2; comments+=$3; sloc+=$4 } END { print "files:", files, "\tcode:", sloc, "\ttotal:", sloc + comments }' cloc.csv