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
  • 84,225
  • 14
  • 89
  • 153
DOS HASAN
  • 323
  • 1
  • 9

1 Answers1

1

I suggest:

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

or

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

See: The Stack Overflow Regular Expressions FAQ

Cyrus
  • 84,225
  • 14
  • 89
  • 153