1 |
On Saturday 24 May 2008, 17:22, Robin Atwood wrote: |
2 |
|
3 |
> Regexs are not my strong point! I am trying to get a list of service |
4 |
> scripts that provide virtual services. Each such script contains a |
5 |
> line like: |
6 |
> |
7 |
> provide dns |
8 |
> |
9 |
> i.e. the line starts with one or more spaces, followed by the text |
10 |
> "provide", followed by one or more spaces and a single word. i have |
11 |
> come up with: |
12 |
> |
13 |
> grep -e ^\s+provide\s+\w /etc/init.d |
14 |
> |
15 |
> but, as usual, nothing is matched. What am I doing wrong? |
16 |
|
17 |
On my system, no initscript has the line "provide dns" in it, so it might |
18 |
be possible that you don't have any file with that line. |
19 |
|
20 |
That said, you should use -r, and you don't need the -e switch: |
21 |
|
22 |
grep -r '^[[:space:]]\{1,\}provide[[:space:]]\{1,\}dns' /etc/init.d |
23 |
|
24 |
or, perhaps clearer |
25 |
|
26 |
grep -rE '^[[:space:]]+provide[[:space:]]+dns' /etc/init.d |
27 |
-- |
28 |
gentoo-user@l.g.o mailing list |