Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!zaphod.mps.ohio-state.edu!mips!smsc.sony.com!dce From: dce@smsc.sony.com (David Elliott) Newsgroups: comp.unix.questions Subject: Re: what does \e do in :s/./\e&/ in vi? (was: merging 2 files) Message-ID: <1990May7.162837.8995@smsc.sony.com> Date: 7 May 90 16:28:37 GMT References: <1990May5.193350.3445@chinet.chi.il.us> <4381@iis.UUCP> Reply-To: dce@Sony.COM (David Elliott) Organization: Sony Microsystems Corp. Lines: 40 In article <4381@iis.UUCP> kells@iis.ethz.ch (Kevin Kells) writes: >A little experimentation (didn't use source) proved that there are at >least three such \? "commands" that can be used in this substitution >context. Two I understand: \l (not \L) and \u, which convert upper case >to lower case and vice versa, respectively. But a third, \e, also >seems to do something, though I can't figure out what. In the 4.3BSD USD section 16 ("Ex Reference Manual"), section 8.5 ("Subsitute replacement patterns"), a number of such commands are documented. The sequence \& is replaced by the entire matched text. The sequence \ is replaced by the text matching the th expression delimited by \( and \). The sequence \u and \l convert the next character in the text to be converted to upper or lower case. The sequence \U and \L convert the entire next replacement to upper or lower case. The sequences \E and \e turn off the case conversion. An example of using \U and \E together is to convert the text This is line 1 using the conversion command :s/^\(.*\)is\(.*\)$/\U\1was\E\2/. The result is THIS WAS line 1 That is, even the literal "was" is converted to upper-case because the \U is in force until \E (or \e) is given. -- David Elliott dce@smsc.sony.com | ...!{uunet,mips}!sonyusa!dce (408)944-4073 "Nature hates both a vacuum and a vacuum cleaner too" -- The Residents