Converting to uppercase/lowercase in sed

Randal Schwartz merlyn at iwarp.intel.com
Fri Aug 17 09:21:51 AEST 1990


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?
| In EX the command
| s/asdf/\U&/
| changes the string asdf to ASDF, but ed and sed do not seem to be as
| sophisticated as ex :-(
| 
| Any ideas?

yeah, the not very well documented "y" command.

	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. :-)
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list