Extract substring in a file

Hello,

A question please.

A have a file that contains a string. Ex:
AAAABBCCCCCDDEEEEEEEEEEFF

I'd want to recover 2 substrings, 'BB' and 'FF' and then leave them in a new file.

Could anoyone help me please?

Thanks in advance

Until you give us more information on how to identify or to locate those substrings, try echo BBFF > newfile

From position 5, 2 caracters (ex:"BB") and from position 25, 2 caracters (ex:"FF") in a file.
Thanks in advance

This thread is a less clear duplicate of the thread Extract a substring from a file. This thread is closed.