Gentoo Archives: gentoo-user

From: Grant Edwards <grant.b.edwards@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: [OT] Use of sed
Date: Wed, 24 Jun 2009 15:10:25
Message-Id: h1teoa$k62$3@ger.gmane.org
In Reply to: Re: [gentoo-user] [OT] Use of sed by Peter Humphrey
1 On 2009-06-24, Peter Humphrey <peter@××××××××××××××.org> wrote:
2 > On Wednesday 24 June 2009 12:28:05 Alex Schuster wrote:
3 >
4 >> man sed answers your second question :)
5 >
6 > s/regexp/replacement/
7 > Attempt to match regexp against the pattern space. If successful,
8 > replace that portion matched with replacement. The replacement may
9 > contain the special character & to refer to that portion of the pattern
10 > space which matched, and the special escapes \1 through \9 to refer to
11 > the corresponding matching sub-expressions in the regexp.
12 >
13 > No mention of using a different separator, and I couldn't find
14 > any other reference either. I did look before asking.
15
16 Apparently that's something that everybody "just knows" so it
17 doesn't need to go in the man page. :)
18
19 It is, however, in the 'info' page:
20
21 The s' Command
22 ===============
23
24 The syntax of the s' (as in substitute) command is
25 s/REGEXP/REPLACEMENT/FLAGS'. The /' characters may be
26 uniformly replaced by any other single character within any
27 given s' command. The /' character (or whatever other character
28 is used in its stead) can appear in the REGEXP or REPLACEMENT
29 only if it is preceded by a \' character.
30
31
32 --
33 Grant Edwards grante Yow! BARBARA STANWYCK makes
34 at me nervous!!
35 visi.com