Skip to content

Instantly share code, notes, and snippets.

@tuksik
Created April 20, 2014 23:26
Show Gist options
  • Save tuksik/11127903 to your computer and use it in GitHub Desktop.
Save tuksik/11127903 to your computer and use it in GitHub Desktop.
Add ORGANIZATION in librarian-puppet-modules
<?php
$file = file('librarian-puppet-modules.txt');
$new_modules = array();
foreach($file as $key=>$row){
$pattern = '%puphpet/.*-%i';
preg_match($pattern, $row, $matches);
$word = str_ireplace('puphpet/','',$matches[0]);
$word = str_ireplace('-','',$word);
$new_row = str_ireplace("mod '","mod '$word/",$row);
$new_modules[] =$new_row;
}
file_put_contents('new_modules.txt',$new_modules);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment