grep: match i to j occurences of abc

From: Penna Elabi (terebinthus_at_go.com)
Date: 08/30/03


Date: 30 Aug 2003 10:50:31 -0700

I have file test:

   abc
   abc abc abc
   abc abc abc abc

How do I print with grep lines where abc occurs at least 3 times but
no more than 4 times (i.e. second and third line):

   abc abc abc
   abc abc abc abc

I have read man grep, and it says:

   \{i,j\}
       matches any number of occurrences of the character matched by
       the BRE from i to j, inclusive.

So, I tried these:

   grep abc\{3,5\} test
   grep 'abc\{3,5\}' test
   grep 'abc'\{3,5\} test

But they don't work.