Удалить в заданных файлах кусок кода
Приветствую всех профи. Может ли кто-нибудь оказать посильную помощь:
Требуется:
- задать список файлов, в котором будет производиться поиск;
- задать список переменных name.
Программа находит блок кода с указанной переменной name и удаляет весь блок кода.
Пример трех блоков кода:
Код:
[1846]
; cse_abstract properties
section_name = climable_object
name = clmbl#0
position = -106.643463134766,-2.1507089138031,-143.208633422852
direction = 9.43627092055976e-005,3.14159274101257,-1.57082176208496
; cse_alife_object properties
game_vertex_id = 703
distance = 0
level_vertex_id = 172
object_flags = 0xffffffbf
; cse_shape properties
shapes = shape0
shape0:type = box
shape0:axis_x = 1.38665246963501,0,0
shape0:axis_y = 0,0.363929748535156,0
shape0:axis_z = 0,0,0.00012969970703125
shape0:offset = 0,0,0
[1857]
; cse_abstract properties
section_name = lights_hanging_lamp
name = lights_gi_r2_blue_0004
position = -71.9155960083008,-0.432599604129791,-134.792053222656
direction = 0,0,0
; cse_alife_object properties
game_vertex_id = 703
distance = 0
level_vertex_id = 172
object_flags = 0xffffffba
custom_data = <<END
[collide]
ignore_static
END
; cse_visual properties
; cse_ph_skeleton properties
; cse_alife_object_hanging_lamp properties
main_color = 0xff78879d
main_brightness = 0.100000001490116
main_color_animator = light\omni_01
main_range = 4.5
light_flags = 0x8
health = 100
main_virtual_size = 0.100000001490116
ambient_radius = 2
ambient_power = 0.100000001490116
main_cone_angle = 2.09439516067505
glow_radius = 0.699999988079071
[2518]
; cse_abstract properties
section_name = space_restrictor
name = val_farm_zone
position = -136.152282714844,0.170738220214844,-504.968627929688
direction = 0,0,0
; cse_alife_object properties
game_vertex_id = 811
distance = 0
level_vertex_id = 316473
object_flags = 0xffffff3e
story_id = 435
; cse_shape properties
shapes = shape0
shape0:type = sphere
shape0:offset = 0,0,0
shape0:radius = 9.46899890899658
; cse_alife_space_restrictor properties
restrictor_type = 3
Например. Если задать программе удалить блок со значением name = val_farm_zone, она должна удалить весь этот блок:
Код:
[2518]
; cse_abstract properties
section_name = space_restrictor
name = val_farm_zone
position = -136.152282714844,0.170738220214844,-504.968627929688
direction = 0,0,0
; cse_alife_object properties
game_vertex_id = 811
distance = 0
level_vertex_id = 316473
object_flags = 0xffffff3e
story_id = 435
; cse_shape properties
shapes = shape0
shape0:type = sphere
shape0:offset = 0,0,0
shape0:radius = 9.46899890899658
; cse_alife_space_restrictor properties
restrictor_type = 3
Заранее благодарю.
|