Remove PHP Closing Tags – Shell Script


find . -type d \( -path ./typo3/contrib/idna -o -path ./typo3/contrib/pear -o -path ./typo3/sysext/adodb/adodb -o -path ./typo3/sysext/openid/lib/php-openid -o -path ./typo3/sysext/openid/lib/php-openid/Auth \) -prune -o -name '*.php' -print | while read FILE; do tail -n1 $FILE | grep '^?>$' && sed -i '$ d' $FILE; done

find . -type f -name \*.php | while read FILE; do tail -n1 $FILE | grep '^$' && sed -i '$ d' $FILE; done

find . -type f -name \*.php | while read FILE; do tail -n1 $FILE | grep '^$' && sed -i '$ d' $FILE; done

find . -type f -name \*.php | while read FILE; do tail -n1 $FILE | grep '^$' && sed -i '$ d' $FILE; done

By Christian Kuhn
Quelle: forge.typo3.org

P.S.
Anpassung für OSX


.. sed -i '' ..

hinter dem sed -i LEERZEICHEN “

Quelle:
http://stackoverflow.com/questions/7573368/in-place-edits-with-sed-on-os-x