bsdperimeter/pfsense-packages — pull request #287 by Fesoj (2012-07-21 12:26:13+00:00)
Title: Replace the complicated sed regexp with a simpler one and correct the se...

...d cmd invocation. The trick is to find the line with an address expression, the rest is pretty generic. To test the approach copy a few lines from a rules file and call from the php-cli:

test-co.rules");
exec("sed -f uncomment.sed test-co.rules > test-uc.rules");
// perform a quick check: test.rules should be identical to test-uc.rules
exec("diff -u test.rules test-uc.rules > delta");
$delta = file_get_contents('delta');
unlink('delta');
echo "\n$delta\n";
?>