#!/bin/bash # Joe Gillotti - 11/12/2012 - 1:13AM # -- # Line counter. Recursively totals up line counts, with and # without empty lines in .txt files in the current directory lines="$(find . -type f -iname '*.txt' -exec cat {} \;)" count=$(wc -l <<< "$lines") noempty=$(sed '/^$/d' <<< "$lines" | wc -l) echo with empty lines: $count echo without empty lines: $noempty echo empty lines: $(expr "$count" - "$noempty")