Skip to content

Instantly share code, notes, and snippets.

@mfrost503
Created July 16, 2015 23:41
Show Gist options
  • Save mfrost503/ae44853e27b37f73c09f to your computer and use it in GitHub Desktop.
Save mfrost503/ae44853e27b37f73c09f to your computer and use it in GitHub Desktop.
One Liners from the mail conversion
## Find all the files that in the directory that and 1 directory deeper that were using mail
find ./ -maxdepth 2 -type f -name '*.php' -print0 | xargs -0 grep -l \!mail\( | xargs sed -i "3i require_once \'..\/path\/to\/sendgrid\';"
## 3rd line put it after the <?php and session_start();
## Find all the files that have the sendGrid.php require and aren't using the sendGridMail function
find ./ -maxdepth 2 -type f -print '*.php' -print0 | xargs -0 grep -l sendGrid\.php | xargs grep -L sendGridMail\( | xargs sed -i 's/\!mail\(/\!sendGridMail\(/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment