#!/bin/bash
s='david
Sam
toNy
3matt
5$!john'
sed 's/[[:alpha:]]/\U&/' <<< "$s"