Last active
December 24, 2015 19:39
-
-
Save joshribakoff/6852259 to your computer and use it in GitHub Desktop.
Shorten the docblocks, multi file recursive multi-line find & replace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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