You can try:
Code:
for i in /path/to/logs/today/* ; do
zcat $i
done | grep '%[A-Z0-9_]\+-' | grep -v 'Primary ID' | wc -l
The major difference is that the "for i in" (and the wildcard list) is handled by bash and is not passed as a parameter list (as in "zcat /path/to/logs/today/*") is done, so it doesn't have the same restrictions (memory allocation for parameters for an exec...)
Alternatively you could use find to serialize such access:
Code:
find /path/to/logs/today -name '*' -exec zcat {} ';' | grep '%[A-Z0-9_]\+-' | grep -v 'Primary ID' | wc -l
This works because find is performing the "readdir" and the filename expansion search (the -name '*'), then executes zcat on each file it finds.
In both cases, there is one zcat process per file. Otherwise you have to do some awkward thing like reading the file name 1000 times to make a list, then execute a zcat for that 1000 list -- and you still have the issue of creating that list using something like find.