Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!rex!uflorida!haven!umbc3!math13.math.umbc.edu!rouben From: rouben@math13.math.umbc.edu (Rouben Rostamian) Newsgroups: comp.editors Subject: Re: Change cases in VI Message-ID: <4658@umbc3.UMBC.EDU> Date: 11 Dec 90 02:50:50 GMT References: <1990Dec11.005842.13795@pa.dec.com> Sender: newspost@umbc3.UMBC.EDU Reply-To: rouben@math13.math.umbc.edu.UUCP (Rouben Rostamian) Distribution: na Organization: Mathematics Department University of Maryland, Baltimore County Lines: 26 In article <1990Dec11.005842.13795@pa.dec.com> reader@wsl.dec.com (News Reader) writes: > >Is there an easy way to change the whole file from upper case to lower case or >vice versa? I don't want to do 26 substitutions to change character by >character. If you insist on doing it in vi, here it is: :%s/./\U&/g or alternatively: :%s/[a-z]/\U&/g Both of these convert characters to uppercase. To convert to lowercase replace "U" with "L". If you are not already editing the file, you should not start up vi; use tr(1) instead: tr '[a-z]' '[A-Z]' outfile Now let's see a slew of solutions using sed, ed, ex, awk, perl, C, BASIC flow in. :-( -- Rouben Rostamian Telephone: (301) 455-2458 Department of Mathematics and Statistics e-mail: University of Maryland Baltimore County bitnet: rostamian@umbc Baltimore, MD 21228, U.S.A. internet: rostamian@umbc3.umbc.edu