1 |
:) Thanks very much. |
2 |
|
3 |
Now that I read your answear I searched in a book the significant of *,+ and |
4 |
others and I suppose I understood. |
5 |
|
6 |
Thanks |
7 |
|
8 |
2005/11/7, Willie Wong <wwong@×××××××××.edu>: |
9 |
> |
10 |
> On Mon, Nov 07, 2005 at 01:44:42AM -0200, Rafael Barreto wrote: |
11 |
> > Hi, |
12 |
> > |
13 |
> > I'm learning about the use of the sed command and I have some questions. |
14 |
> I'm |
15 |
> > trying to read in /etc/conf.d/clock the CLOCK variable with: |
16 |
> > |
17 |
> > sed '/^CLOCK="*"$/p' /etc/conf.d/clock |
18 |
> > |
19 |
> > This command, in principe, must print in screen the line that contains |
20 |
> > CLOCK= in the begin, contains anything between double quotes and ends. |
21 |
> Well, |
22 |
> > this doesn't return anything. If I enter the above command without $, |
23 |
> all is |
24 |
> > ok. But, if I would like to return just that line contains |
25 |
> CLOCK="anything" |
26 |
> > and nothing more? For example, |
27 |
> |
28 |
> No it doesn't. What you want is the regexp ^CLOCK=".*"$ if you want |
29 |
> anything (including nothing) between the double quotes, or |
30 |
> ^CLOCK=".+"$ if you want something (excluding nothing) between the |
31 |
> double quotes. |
32 |
> |
33 |
> The reason that removing the trailing $ worked is that it matched the |
34 |
> CLOCK=" part, the * character specifies 0 or more iterates of the |
35 |
> previous character, which is " |
36 |
> |
37 |
> HTH |
38 |
> |
39 |
> W |
40 |
> -- |
41 |
> Q: Why won't Heisenberg's operators live in the suburbs? |
42 |
> A: They don't commute. |
43 |
> Sortir en Pantoufles: up 4 days, 5:24 |
44 |
> -- |
45 |
> gentoo-user@g.o mailing list |
46 |
> |
47 |
> |