Skip to content

Instantly share code, notes, and snippets.

@ma2thieu
Created February 23, 2013 18:50
Show Gist options
  • Save ma2thieu/5020851 to your computer and use it in GitHub Desktop.
Save ma2thieu/5020851 to your computer and use it in GitHub Desktop.
replace php short tags (<?) with long one (<?php)
#!/bin/bash
# first short tags with something that is not a letter after
find . -iname "*.php" -print0 | xargs -0 -I{} sed -i -r 's/(<\?)([^a-zA-Z])/\1php\2/g' '{}'
# then short tags at end of line
find . -iname "*.php" -print0 | xargs -0 -I{} sed -i -r 's/<\?$/<\?php/g' '{}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment