#!/bin/bash
s='C line 1
c line 2
B line 3
d line 4
E line five'

grep '^[A-Z].*[0-9]$' <<< "$s"