Count number of lines of .gz files recursively on directory?
my directory:
.├── a.gz├── b.gz└── t └── f.gz
command to echo and count lines of every gz file found:
find . -type f -name '*.gz' -exec bash -c 'echo $1;gunzip -c $1 | wc -l' dummy {} \;
output:
./a.gz5./b.gz6./t/f.gz3
then, in order to obtain a grand total:
echo $((`find . -type f -name '*.gz' -exec bash -c 'gunzip -c $1 | wc -l' dummy {} \; | paste -sd+`))
output:
14