' HEADERABC' egrep -ha '^.{1}(HEAD)' 1.txt | egrep -ha '^.{7}(A)' > 2.txt
'HEADERABC' egrep -ha '^(HEAD)' 1.txt > 2.txt egrep -ha '^.{0}(HEAD)' 1.txt > 2.txt
' HEADERABC' ' TAILER123' egrep -ha '^.{1}(HEAD|TAIL)' 1.txt > 2.txt
' HEADERABC' ' TAILER123' egrep -ha '^.{1}(HEAD).{2}(AB)|^.{1}(TAIL)' 1.txt > 2.txt