Q:

unix: looping through results of find command

I have a find command that outputs as I would like (it looks for files with strelka in the name and ends with .vcf):

find . -name *strelka* | grep '.vcf$'

But I want to then iterate over each and perform additional stuff. 
To simply experiment, I'm just having it do a line count on each file (but ultimately I would want to do more in the end, this is just me playing around), but it already doesn't seem to work.
I have :

for i in find . -name \*strelka\* | grep '.vcf$'; do wc -l $i; done 

Anyone know what is wrong with this?

A:

Use find . -name '*strelka*.vcf', thereby avoiding the grep and letting you use find ... -exec
Either pipe into xargs, or use -exec:
find . -name '*strelka*.vcf' | xargs wc -l  

find . -name '*strelka*.vcf' -exec wc -l '{}' \;

Prefer the latter, for various reasons.
Your approach (with a $(...) around your find) is OK, except:

You'll have grief if there are spaces in filenames. (You'd have grief with xargs too - there's a way round that involving \0, but it's a bit arcane.)
You'll exceed the command line length limit if there are too many matching files.

A:

Assuming you are using a recent (4.0 or greater) version of bash, you don't need to use find for this; a file pattern is sufficient, along with the globstar option.
shopt -s globstar
for i in **/*strelka*.vcf; do
    wc -l $i
done

For a small number of files, you can probably just use
wc -l **/*strelka*.vcf

For a large number of files,
find -name '*strelka*.vcf' -execdir wc -l '{}' +

is most efficient.

