Skip to main content
2 of 7
added 83 characters in body
Gilles Quénot
  • 36.7k
  • 7
  • 74
  • 97

With , 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 a; do
    x=( $a )
    printf '%s ' ${a[@]^}
    echo
done < file

Output:

Aaa Zzz Eee Rrr 
Foo Bar
Gilles Quénot
  • 36.7k
  • 7
  • 74
  • 97