Pattern mining from a genomic sequence I need to find the following pattern from a genomic sequence

TTCGB-N15-TTCGB
B represents C, G, or T
N15 represents A, T, G or C and these four base combination should have the length of 15 bases.


To do the same, I tried grep command, but I could not specify B and N15 in the grep command line. Therefore, please help me to find the same.

For example, I have a nucleotide sequences as follows

&gt;ATGCTTATTGCCCATTTCGTGCATGCATATGCGCATTCGCGATCGATTAGGGATAT


Expected outcome,


  TTCGTGCATGCATATGCGCATTCGC


Thanks in advance.
echo "&gt;ATGCTTATTGCCCATTTCGTGCATGCATATGCGCATTCGCGATCGATTAGGGATAT" | grep -oP  'TTCG[CGT][ATGC]{1,15}TTCG[CGT]'



[CGT] looks for one occurrence of one of the three.
[ATGC]{1,15} looks for "up to 15 letter long" combinations of the four bases.


Moreover, -P makes your regex call Perl-like and is required to make this regex work. Different regex flavors behave (slightly) differently.