Skip to content

Instantly share code, notes, and snippets.

@joshribakoff
Last active December 24, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshribakoff/6852259 to your computer and use it in GitHub Desktop.
Save joshribakoff/6852259 to your computer and use it in GitHub Desktop.
Shorten the docblocks, multi file recursive multi-line find & replace
<?php
/** Enable blash globbing, or run with zsh instead of bash */
`ls **/*.php > list.txt`;
$find = "/**
* Vehicle Fits (http://www.vehiclefits.com for more information.)
* @copyright Copyright (c) Vehicle Fits, llc
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/";
$replace = "/**
* Vehicle Fits (http://www.vehiclefits.com for more information.)
* @copyright Copyright (c) Vehicle Fits, llc
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/";
$files = explode("\n", file_get_contents('list.txt'));
foreach($files as $file) {
$code = file_get_contents($file);
$code = str_replace($find, $replace, $code);
file_put_contents($file, $code);
echo $file . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment