#! /bin/sed -f

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

# suppose input is "line"

# change pat space to: \nLINE\nline
h  
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
G  
s/^/\
/

# merge one upper, one lower... 
# LlIiNnEe\n\n
t a
:a
s/\n\(.\)\(.*\)\n\(.\)/\1\3\
\2\
/
t a

# on words, remove the first lower, and make it upper upper
# LLIiNnEe\n\n
s/\([a-zA-Z]\)[a-zA-Z]\([a-zA-Z][a-zA-Z]*\)/\1\1\2/g

# remove second duped char... 
# Line\n\n
s/.\(.\)/\1/g

P  
d  

### colorized by sedsed, a debugger and code formatter for sed scripts
### original script: http://sed.sf.net/grabbag/scripts/cflword4.sed