sed 's,.*,\L&,; s,.,\u&,; s,[ 0-9][^ ],\U&,g' file ^ ^ ^ | | | | | | | | Capitalise any non-space char after a space or a numeric | Uppercase the first char Lower case the whole name