Scripting

Script to parse file content from one file to another

This is a PHP script that parse file content from a file and writes this to another config file. #!/usr/bin/php -q < ?php if ($_SERVER[‘argv’][1] == ”) { die(“Usage: ./nagiosparse filename. Sourcefile must be a list with ,\n”); } $strFile = $_SERVER[‘argv’][1]; $arrContents = explode(“\n”, file_get_contents($strFile)); foreach ($arrContents as $strLine) { if(!empty($strLine)) { $arrCells = […]

Read More