For example, given:
USCAGoleta9311734.5021-120.1287855805
I want to extract just:
US
You've gotten several good answers and I'd go with the Bash builtin myself, but since you asked about sed and awk and (almost) no one else offered solutions based on them, I offer you these:
echo "USCAGoleta9311734.5021-120.1287855805" | awk '{print substr($0,0,2)}'
and
echo "USCAGoleta9311734.5021-120.1287855805" | sed 's/\(^..\).*/\1/'
The awk one ought to be fairly obvious, but here's an explanation of the sed one: