Welcome to the forum @aalex!
See the awk script used in this tutorial:
Uppercase valid nucleotide base codes (degenerate codes are accepted).