what does \e do in :s/./\e&/ in vi? (was: merging 2 files)
David Elliott
dce at smsc.sony.com
Tue May 8 02:28:37 AEST 1990
In article <4381 at iis.UUCP> kells at 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 \<digit> is replaced by the text matching the <digit>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 at smsc.sony.com | ...!{uunet,mips}!sonyusa!dce
(408)944-4073
"Nature hates both a vacuum and a vacuum cleaner too" -- The Residents
More information about the Comp.unix.questions
mailing list