Использование grep
:
$ grep -io "[A-Z]\{6\}[0-9]\{2\}[A-Z][0-9]\{2\}[A-Z][0-9]\{3\}[A-Z]" file
MLLSNT82P65Z404U
mrtmtt25d09f205z
или
$ grep -Eio "[A-Z]{6}[0-9]{2}[A-Z][0-9]{2}[A-Z][0-9]{3}[A-Z]" file
или
$ grep -Pio "[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]" file
man grep
:
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input
files.
-o, --only-matching
Print only the matched (non-empty) parts of a matching line,
with each such part on a separate output line.
-E, --extended-regexp
Interpret PATTERN as an extended regular expression
-P, --perl-regexp
Interpret the pattern as a Perl-compatible regular expression
(PCRE). This is highly experimental and grep -P may warn of
unimplemented features.