Converting to uppercase/lowercase in sed

Tom Christiansen tchrist at convex.COM
Fri Aug 17 19:33:54 AEST 1990


In article <1990Aug16.232151.23436 at iwarp.intel.com> merlyn at iwarp.intel.com (Randal Schwartz) writes:
>In article <3766 at umbc3.UMBC.EDU>, rostamia at umbc5 writes:
>| Is there a way to convert characters to uppercase or to lowercase in sed?
>	y/a-z/A-Z/
>uppercases the pattern space.  You'll have to juggle the pattern and
>hold spaces if you want just part of a line uppercased.
>
>Or get Perl. :-)

Yes, the y command is a pain because of not being able to act
on just part of a line.

But, um, Randal has (understandably :-) been doing so much perl
he's attributed perl intelligence to sed, which just isn't so.

In sed you really have to do this:

    y/abcdefghijklmnopqrstuvxyz/ABCDEFGHIJKLMNOPQRSTUVXYZ/

And make sure they match up exactly.

--tom
--
  "UNIX was never designed to keep people from doing stupid things, because 
   that policy would also keep them from doing clever things." [Doug Gwyn]



More information about the Comp.unix.questions mailing list