Skip to content

Instantly share code, notes, and snippets.

@TinoDidriksen
Created October 4, 2021 08:50
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 TinoDidriksen/ff96235c1ed6bae791eb39923d47aed0 to your computer and use it in GitHub Desktop.
Save TinoDidriksen/ff96235c1ed6bae791eb39923d47aed0 to your computer and use it in GitHub Desktop.
grep -rl '<?php' * | xargs -r grep -rl '?>' | xargs -rn1 php -r '$f=file_get_contents($argv[1]); if (preg_match("~[?]>[\s\n]*$~", $f)) { $f = trim(preg_replace("~[?]>[\s\n]*$~", "", $f))."\n"; file_put_contents($argv[1], $f); }' --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment