Sed » История » Версия 1
Андрей Волков, 2014-04-18 14:30
1 | 1 | Андрей Волков | h1. Sed |
---|---|---|---|
2 | |||
3 | |||
4 | h2. Добавление строк в секции (range) |
||
5 | |||
6 | <pre> |
||
7 | sed -e '/define service/,/\(\}\|\<use\>\)/{/\}/i\' -e 'use base' -e '}' file |
||
8 | </pre> |
||
9 | |||
10 | h2. Было |
||
11 | |||
12 | <pre> |
||
13 | define service { |
||
14 | host_name do.kemerovo.lenina82 |
||
15 | service_description ping loopback |
||
16 | use base,ping_loopback |
||
17 | check_command ubrr_check_ping_far |
||
18 | register 1 |
||
19 | } |
||
20 | define service { |
||
21 | host_name do.kemerovo.lenina82 |
||
22 | service_description ping ubrr tun295 [e-lite] 10.10.50.133 |
||
23 | check_command check_address_alive!10.10.50.133 |
||
24 | notification_options c,r,f |
||
25 | register 1 |
||
26 | } |
||
27 | define service { |
||
28 | host_name do.kemerovo.lenina82 |
||
29 | service_description ping ubrr tun296 [zsttk] 10.10.250.49 |
||
30 | check_command check_address_alive!10.10.250.49 |
||
31 | notification_options c,r,f |
||
32 | register 1 |
||
33 | } |
||
34 | </pre> |
||
35 | |||
36 | h2. Стало |
||
37 | |||
38 | <pre> |
||
39 | define service { |
||
40 | host_name do.kemerovo.lenina82 |
||
41 | service_description ping loopback |
||
42 | use base,ping_loopback |
||
43 | check_command ubrr_check_ping_far |
||
44 | register 1 |
||
45 | } |
||
46 | define service { |
||
47 | host_name do.kemerovo.lenina82 |
||
48 | service_description ping ubrr tun295 [e-lite] 10.10.50.133 |
||
49 | check_command check_address_alive!10.10.50.133 |
||
50 | notification_options c,r,f |
||
51 | register 1 |
||
52 | use base |
||
53 | } |
||
54 | define service { |
||
55 | host_name do.kemerovo.lenina82 |
||
56 | service_description ping ubrr tun296 [zsttk] 10.10.250.49 |
||
57 | check_command check_address_alive!10.10.250.49 |
||
58 | notification_options c,r,f |
||
59 | register 1 |
||
60 | use base |
||
61 | } |
||
62 | </pre> |