Regular Expression to match repeated characters

Hello All

I have file which contain sample data like below -

test.txt
----------------------------------------------
jambesh aaa india
trxxx

sdasd
mentor
asss
light
train
bbblah
---------------------------------------------

I want to write a regX which would print only those line which contain patteren like xxx or aaa bbb etc.

When ever the same character repeated atleast 3 times that line should print

Here the output should :
------------------------
jambesh aaa india
trxxx
asss
bbblah

etc.

Any suggestion ?

$
$ cat test.txt
jambesh aaa india
trxxx
sdasd
mentor
asss
light
train
bbblah
$
$ perl -ne '/(.)\1\1/ && print' test.txt
jambesh aaa india
trxxx
asss
bbblah
$
$

tyler_durden

I have a file called texto.txt

like this

sil
a
b
c
s
sil
b
a

and i wold like to have this output, a new file like this

sil
a
b
c
s

I want to erase all repeated words, i tried to do it but i couldn't, if somebody can help me i will apreciate (Sorry for my bad english)

Usted debe utilizar ingl�s

Con perl no he tratado de hacerlo, voy a ver si te hallo una soluci�n, pero com bash si podr�as hacerlo, usando "sort", pero te quedar�a ordenado el texto.

leo@lein:~/Escritorio$ cat file.txt
sil
a
b
c
s
sil
b
a
leo@lein:~/Escritorio$ cat file.txt | sort -u
a
b
c
s
sil
leo@lein:~/Escritorio$ 
cat "file.txt" | sort | uniq -u
#!/usr/bin/perl
use strict;
use warnings;
if(!@ARGV)
{
	print "$0 <file>\n";
	exit(1);
}
open(FILE, q[<], "$ARGV[0]") or die("No se pudo leer el archivo $ARGV[0]\n");
my %seen = ();
while(<FILE>)
{
	$seen{$_}++;
	next if($seen{$_})>1;
	print;
}