Random word generation with AWK

Hi - I have a word GTTCAGAGTTCTACAGTCCGACGAT

I need to extract all the possible "chunks" of 7 or above letter "words" from this.

SO, my out put should be

GTTCAGA
TTCAGAG
TCAGAGT
CAGAGTTCT
TCCGACGAT
CAGTCCGACG

etc.

How can I do that with awk or any other language? I have no clue where to start.

Thanks a lot in advance.

echo "GTTCAGAGTTCTACAGTCCGACGAT" | perl -nle 'for ($j=7;$j<=length($_);$j++){for ($i=0;$i<=length($_)-$j;$i++){print substr($_,$i,$j)}}'

@bartus

thanks a lot for the quick reply. It works like charm. :b::slight_smile: