Gentoo Archives: gentoo-user

From: "Arttu V." <arttuv69@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] Use of sed
Date: Wed, 24 Jun 2009 08:52:08
Message-Id: fecdbac60906240152n40b950ccm911d682e2d78adb3@mail.gmail.com
In Reply to: Re: [gentoo-user] [OT] Use of sed by Neil Bothwick
1 On 6/24/09, Neil Bothwick <neil@××××××××××.uk> wrote:
2 > On Wed, 24 Jun 2009 00:48:07 +0100, Peter Humphrey wrote:
3 >> And while I'm at it, how do I change the field
4 >> separator from / to enable me to search on that character?
5 >
6 > By using something else, you don't need to tell sed, it works it out for
7 > itself, just use something that isn't in your search string, : is a good
8 > candidate.
9
10 If I read his question right, he asked about just the simple matchers:
11 //. Perl solves this problem with the optional m in front (m//), so
12 you can do m:/foo: or m+/foo+, but I don't know of a similar toggle
13 for sed (well, I'm a sed newbie, so there might still be one).
14
15 I don't even think substituting the string with itself (s+/foo+/foo+)
16 would work as I think s/// will succeed every time, even when it
17 doesn't actually substitute anything, so maybe it cannot be used for
18 an "if-then" in sed either?
19
20 --
21 Arttu V.