O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Replacement Patterns

The characters in the following table have special meaning only in replacement patterns, used for example in editing, when searching for and replacing text.

Character

Pattern

\

Turn off the special meaning of the following character.

\n

Reuse the text matched by the nth subpattern previously saved by \( and \) as part of the replacement pattern. n is a number from 1 to 9, with 1 starting on the left.

&

Reuse the text matched by the search pattern as part of the replacement pattern.

~

Reuse the previous replacement pattern in the current replacement pattern. Must be the only character in the replacement pattern (ex and vi).

%

Reuse the previous replacement pattern in the current replacement pattern. Must be the only character in the replacement pattern (ed).

\u

Convert the first character of replacement pattern to uppercase.

\U

Convert the entire replacement pattern to uppercase.

\l

Convert the first character of replacement pattern to lowercase.

\L

Convert the entire replacement pattern to lowercase.

\e

Turn off previous \u or \l.

\E

Turn off previous \U or \L.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required