Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!letni!mic!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.editors Subject: Re: Change cases in VI Message-ID: <110690@convex.convex.com> Date: 12 Dec 90 05:58:24 GMT References: <1990Dec11.011804.14702@pa.dec.com> Sender: usenet@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Distribution: na Organization: CONVEX Software Development, Richardson, TX Lines: 27 In article ed@lvw6.lvw.fac.com (Ed Allen) writes: >From within vi you could try: >:%s/./\U&/g >Which tells vi: >on every line of the buffer, > substitute for each char the UPPERCASE of that char I've seen a lot of people suggest this, but it's pretty suboptimal. Watch: % cp /etc/termcap . % /bin/time sh -c '(echo "%s/.*/\U&/";echo x)|ex - termcap' 2.502023 real 1.353925 user 0.423176 sys % cp /etc/termcap . % /bin/time sh -c '(echo "%s/./\U&/g";echo x)|ex - termcap' 18.158108 real 8.973235 user 0.462504 sys Just do it all at once. If you're going to do one character at a time, then you could just use \u, which only affects the next chararcter --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "With a kernel dive, all things are possible, but it sure makes it hard to look at yourself in the mirror the next morning." -me