Gentoo Archives: gentoo-user

From: Andrey Falko <ma3oxuct@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Need help with a regex
Date: Sat, 24 May 2008 15:34:05
Message-Id: 350fc7cf0805240833q1150c23m45aa0cabd69a61d9@mail.gmail.com
In Reply to: Re: [gentoo-user] Need help with a regex by Andrey Falko
1 On Sat, May 24, 2008 at 11:32 AM, Andrey Falko <ma3oxuct@×××××.com> wrote:
2 > On Sat, May 24, 2008 at 11:22 AM, Robin Atwood
3 > <robin.atwood@×××××××××.net> wrote:
4 >> Regexs are not my strong point! I am trying to get a list of service scripts
5 >> that provide virtual services. Each such script contains a line like:
6 >>
7 >> provide dns
8 >>
9 >> i.e. the line starts with one or more spaces, followed by the text "provide",
10 >> followed by one or more spaces and a single word. i have come up with:
11 >>
12 >> grep -e ^\s+provide\s+\w /etc/init.d
13 >
14 > Right now you are saying: match one or more spaces in the begining
15 > followed by provide followed by one or more spaces followed by *one*
16 > word followed by one space and followed by /etc/init.d
17 >
18 > I think you mean: grep -e ^\s+provide\s+\w+ /etc/init.d
19 >>
20 >> but, as usual, nothing is matched. What am I doing wrong?
21 >>
22 I see your mistake....\w means alphanumeric character, not word.
23 >> TIA
24 >> -Robin
25 >>
26 >>
27 >>
28 >>
29 >>
30 >>
31 >>
32 >>
33 >>
34 >>
35 >>
36 >>
37 >> --
38 >> gentoo-user@l.g.o mailing list
39 >>
40 >>
41 >
42 --
43 gentoo-user@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-user] Need help with a regex Robin Atwood <robin.atwood@×××××××××.net>