Gentoo Archives: gentoo-user

From: Renat Golubchyk <ragermany@×××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] Use of sed
Date: Wed, 24 Jun 2009 14:49:13
Message-Id: 20090624164905.7d1c7235@symbox
In Reply to: Re: [gentoo-user] [OT] Use of sed by Peter Humphrey
1 Am Wed, 24 Jun 2009 15:18:02 +0100
2 schrieb Peter Humphrey <peter@××××××××××××××.org>:
3 > On Wednesday 24 June 2009 12:28:05 Alex Schuster wrote:
4 >
5 > > man sed answers your second question :)
6 >
7 > s/regexp/replacement/
8 > Attempt to match regexp against the pattern space. If successful,
9 > replace that portion matched with replacement. The replacement
10 > may contain the special character & to refer to that portion of the
11 > pattern space which matched, and the special escapes \1 through \9 to
12 > refer to the corresponding matching sub-expressions in the regexp.
13 >
14 > No mention of using a different separator, and I couldn't find any
15 > other reference either. I did look before asking.
16
17 Man page is very short. Check the info pages for full documentation.
18 (Almost all tools from GNU userland have a short man page and a long
19 info page. At least that is what they say right at the bottom.)
20
21 Section 3.5 (The `s' Command) states in the first paragraph:
22
23 The syntax of the `s' (as in substitute) command is
24 `s/REGEXP/REPLACEMENT/FLAGS'. The `/' characters may be uniformly
25 replaced by any other single character within any given `s' command.
26 The `/' character (or whatever other character is used in its stead)
27 can appear in the REGEXP or REPLACEMENT only if it is preceded by a `\'
28 character.
29
30
31 Cheers,
32 Renat
33
34 --
35 Probleme kann man niemals mit derselben Denkweise loesen,
36 durch die sie entstanden sind.
37 (Einstein)

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] [OT] Use of sed Paul Hartman <paul.hartman+gentoo@×××××.com>