0

I'm trying to find the lines where the same sequence of 4 or more consecutive characters comes in at least 3 times, using the grep command

 grep '^.*\(....\)*\1*\1*' file.name

for ex

  ADShDS DFDFG HGFDFDFD DFDFD
  ASFG VVFGTTTE DSrFD GFFDSD C
  KKKYX KKKYXFF KaKFVBB KKKYXY

expected output

  ADShDS DFDFG HGFDFDFD DFDFD
  KKKYX KKKYXFF KaKFVBB KKKYXY

but there is something wrong !?

Cyrus
  • 77,979
  • 13
  • 71
  • 125
DOS HASAN
  • 323
  • 8

1 Answers1

1

I suggest:

grep '\(....\).*\1.*\1' file

or

grep -E '(....).*\1.*\1' file

See: The Stack Overflow Regular Expressions FAQ

Cyrus
  • 77,979
  • 13
  • 71
  • 125