One solution using perl, not restricted to only `foo-bar`
$ cat file
aaa-zzz-eee-rrr
foo-bar
code
$ perl -ne 'print join " ", map { ucfirst } split /-/' file
Aaa Zzz Eee Rrr
Foo Bar
Another solution using pure bash
while IFS='-' read -r -a words; do
printf '%s ' "${words[@]^}"
echo
done < file
Output:
Aaa Zzz Eee Rrr
Foo Bar