Raw Input Desired Output
---one---
===two words===
one more test
with digits 1234567890 and words
---One---
===Two Words===
One More Test
With Digits 1234567890 And Words
Script and Comments
Script1
[ 1] s/^[^A-Za-z]*/&\n/
[ 2] :loop
[ 3] /\n$/!{
[ 4] h
[ 5] x
[ 6] s/^[^\n]*\n(.).*/\1/
[ 7] y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
[ 8] x
[ 9] G
[10] s/\n.([A-Za-z]*[^A-Za-z]*)([^\n]*)\n(.)/\3\1\n\2/
[11] b loop
[12] }
[13] s/\n//
Comments
  1. The `-r' option of GNU sed must be used or you have to escape every parenthesis used.
  2. The locale used must be `C' or the character class [A-Za-z] may not be equivalent to the English alphabet.
  3. Steps [2] thru [11] constitute a loop, and one iteration of the loop is required to capitalize a word.
  4. To locate the word to be capitalized in an iteration, a newline character is inserted, either by Step [2] or Step [10], before the beginning of the word in question.
  5. Use a line ===two words=== as an example:
    After StepPattern SpaceHold Space
    1 ===\ntwo words===  
    4 ===\ntwo words=== ===\ntwo words===
    5 ===\ntwo words=== ===\ntwo words===
    6 t ===\ntwo words===
    7 T ===\ntwo words===
    8 ===\ntwo words=== T
    9 ===\ntwo words===\nT T
    10 ===Two \nwords=== T