#! /bin/sed -f

# capit_iv.sed -- capitalize words 
# 
# $Id: capit_iv.sed,v 1.2 1998/07/06 20:32:46 cdua Exp $
# Carlos Duarte, 970528

# idea: 
# . grab all first chars of all words into the second part of line
# . convert that chars
# . for each word, replace first char with those
# 
# if line is: "carlos duarte", then
#
# carlos duarte
# \ncarlos duarte\nCD
# Carlos \nduarte\nD
# Carlos Duarte\n\n

h
s/\([a-zA-Z]\)[a-zA-Z][a-zA-Z]*/\1/g
s/[^a-zA-Z]*//g
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
x
G
s/^[^a-zA-Z]*/&\
/
ta
:a
s/\n[a-zA-Z]\([a-zA-Z][a-zA-Z]*[^a-zA-Z]*\)\(.*\n\)\(.\)/\3\1\
\2/
ta
P
d
