fork download
  1. perl -pe 'if(/\[Section (\w)\]/){if($1 eq 'B'){$f=1;}else{$f=0if($f);}};s/^\$param2=value2$/\$param2=new_value2/ if($f);'
Success #stdin #stdout 0.02s 5348KB
stdin
[Section A]
$param1=value1
$param2=value2

[Section B]
$param1=value1
$param2=value2
$param3=value3

[Section C]
$param1=value1
$param2=value2
$param3=value3


[Section B]
$param1=value1
$param2=value2
$param3=value3

[Section D]
$param1=value1
$param2=value2
$param3=value3
stdout
[Section A]
$param1=value1
$param2=value2

[Section B]
$param1=value1
$param2=new_value2
$param3=value3

[Section C]
$param1=value1
$param2=value2
$param3=value3


[Section B]
$param1=value1
$param2=new_value2
$param3=value3

[Section D]
$param1=value1
$param2=value2
$param3=value3