-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[re-adding the list, so that the archives see the resolution of this thread]
echo filename.*.* | xargs nl --starting-line-number=2
will proceed to chunk your listing into the fewest number of necessary
processes, although you will then have to deal with the fact that each
instance of nl starts its numbering over again. And by using echo (a
shell builtin) instead of ls (an external process), you are using one less
process. But that does not deal with newlines in the glob, so you may
want to use GNU findutils, and:
find -maxdepth 1 -name 'filename.*.*' -print0 \
| xargs -0 nl --starting-line-number=2