1 |
Hi, |
2 |
|
3 |
I'm learning about the use of the sed command and I have some questions. I'm |
4 |
trying to read in /etc/conf.d/clock the CLOCK variable with: |
5 |
|
6 |
sed '/^CLOCK="*"$/p' /etc/conf.d/clock |
7 |
|
8 |
This command, in principe, must print in screen the line that contains |
9 |
CLOCK= in the begin, contains anything between double quotes and ends. Well, |
10 |
this doesn't return anything. If I enter the above command without $, all is |
11 |
ok. But, if I would like to return just that line contains CLOCK="anything" |
12 |
and nothing more? For example, |
13 |
|
14 |
CLOCK="anything" # set clock of the system |
15 |
|
16 |
and |
17 |
|
18 |
CLOCK="anything" |
19 |
|
20 |
are different. |
21 |
|
22 |
Other thing... if i put: |
23 |
|
24 |
sed '/^CLOCK=*/p' /etc/conf.d/clock |
25 |
|
26 |
the return will be anything that contains CLOCK. Why? |
27 |
|
28 |
I suppose that I didn't undestand the use of regular expression |
29 |
metacharacters. So, please, anyone to explain me that? |
30 |
|
31 |
Thanks a lot and sorry by my english... |