I am trying to search for a grep command that will allow me to extract two patterns (words) for every line with random sequence in the middle of a specific length (6 in my case):
ATCAACGCAGAGTACATXXXXXXGGG
Here in my case I have the two words: "ATCAACGCAGAGTACAT" and "GGG" with in the middle 6 letters "XXXXXX" but these can be whatever letter.
I have looked at the already available solution but there is none specific to this one I believe.
Input
ACGCAACGACGACG**ATCAACGCAGAGTACAT****XXXXXX****GGG**AATTTA
AGGGAACGTTGCCG**ATCAACGCAGAGTACAT****XXXXXX****GGG**CATGGA
GGAACGTTGCCAAG**ATCAACGCAGAGTACAT****XXXXXXXXX****GGG**ATG (this does not match for example)
AGGGAACGTTGCCG**ATCAACGCAGAGTACAT****XXXXXX****GGG**CATGGA
Output
ACGCAACGACGACG**ATCAACGCAGAGTACAT****XXXXXX****GGG**AATTTA
AGGGAACGTTGCCG**ATCAACGCAGAGTACAT****XXXXXX****GGG**CATGGA
AGGGAACGTTGCCG**ATCAACGCAGAGTACAT****XXXXXX****GGG**CATGGA
where "XXXXXX" can be every combination of A,C,T,G like AATCGA or AAATCC etc..
How could I do this with grep
or sed
?