ATTN: AWK GURUS!!! (lower to upper conversion)

Michael Morrell morrell at hpsal2.HP.COM
Thu Mar 24 05:28:51 AEST 1988


This is a little less gross, I hope (and it also seems to work).

BEGIN	{
	lower="abcdefghijklmnopqrstuvwxyz"
	upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	}

{	new = ""
	for (i=1; i <= length; ++i) {
		cur = substr($0, i, 1)
		j = index(lower, cur)
		if (j != 0)
			new = new substr(upper, j, 1)
		else
			new = new cur
	}
	print new
}



More information about the Comp.unix.questions mailing list