What is wrong in this grep command?
<p>Okay... so I'm trying to make a dictionary using <em>Crunch</em> and <em>Grep</em> I've also tried using <em>Perl</em> instead.</p>

<pre><code>crunch 8 12 1234567890 -d 2@ | grep -v '\([0-9]\) .*\1.*\1.*\1.*' | grep 41106041
</code></pre>

<p>So, basically i want to filter all passwords which numbers appear 3 times </p>

<pre><code>grep 41106041 
</code></pre>

<p>Is just to test if the code works.. and it doesn't.</p>

<p>I've also tried some "C style" perl code as I'm still a newbie to perl:</p>

<pre><code>#! /bin/perl
@lines=&lt;STDIN&gt;;
$c=0;
foreach $number(@lines)
{
    $acum=undef;
    $pos=0;
    while($pos &lt;= &amp;countdig($number))
    {
        if ($acum=$digit)
        {
            $c=$c+1;
        }
        else
        {
            $c=0;
        }
        $acum=$digit;

    }
    if ($c=3)
    {
        print "$number"." ";
    }
    $c=0;
}

sub countdig
{
    my($j)=0;
    chomp(my(@n)=@_);
    print "first dig $n[$j] \n";
    while($_[0][$j]&gt;=0 &amp;&amp; $_[0][j]&lt;=9)
    {
        $j+=1;

    }
    print "j total : $j  \n";

    $j;
}
</code></pre>

<p>Countdig is supposed to count the number of digits but thing is.. I can't access a scalar variable as a list.. so well if you guys could explain me how to make it work it would be very appreciated.</p>