How to limit the number of search results per folder, for example:

With this command:

```
grep --include=*.php -Ril '<?' '/var/www/'

```

I get the following:

```
/var/www/test.php
/var/www/test1.php
/var/www/phpinfo1.php
/var/www/phpinfoo.php
/var/www/phpinfooo.php
/var/www/1/php.php
/var/www/1/php3.php
/var/www/1/index.php
/var/www/1/indexed.php
/var/www/1/indexin.php
/var/www/test/tester.php
/var/www/test/info.php
/var/www/test/inform.php
/var/www/test/conf.php

```

And I need only 3 results per folder, and therefore it is:

```
/var/www/test.php
/var/www/test1.php
/var/www/phpinfo1.php
/var/www/1/php.php
/var/www/1/php3.php
/var/www/1/index.php
/var/www/test/tester.php
/var/www/test/info.php
/var/www/test/inform.php

```