Created
October 10, 2012 17:12
-
-
Save cam8001/3866995 to your computer and use it in GitHub Desktop.
Removing conf vars from site.conf.php (or whatever)
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
# Only works for vars that are expressed on one line, grep -A1 or a multilne pcregrep | |
# might be useful if you have longer var definitions. | |
# Check extant definitions | |
egrep "[$]conf\['related_videos_return'\]" --include site.conf.php . | |
# Blast em (note bsd/osx sed syntax, the first "" is not needed on gnu grep) | |
find . -type f -name site.conf.php -exec sed -i "" "/[$]conf\['related_videos_return'\]/d" {} \; | |
# Check them again, they are gone! | |
egrep "[$]conf\['related_videos_return'\]" --include site.conf.php . | |
# Code to actually run | |
egrep "conf\['safron_video_feed_uri'\]" --include site.conf.php . | |
find . -type f -name site.conf.php -exec sed -i "" "/[$]conf\['safron_video_feed_uri'\]/d" {} \; | |
egrep "conf\['safron_video_feed_uri'\]" --include site.conf.php . | |
egrep "conf\['pre_roll_uri'\]" --include site.conf.php . | |
find . -type f -name site.conf.php -exec sed -i "" "/[$]conf\['pre_roll_uri'\]/d" {} \; | |
egrep "conf\['pre_roll_uri'\]" --include site.conf.php . | |
egrep "conf\['related_videos_return'\]" --include site.conf.php . | |
find . -type f -name site.conf.php -exec sed -i "" "/[$]conf\['related_videos_return'\]/d" {} \; | |
egrep "conf\['related_videos_return'\]" --include site.conf.php . | |
# We are lucky because all the comments for the above variables are on lines 11,12,13 in every file. | |
for i in `egrep -rL "Maya Video" . --include site.conf.php`; do sed -i "" "11,13d" $i; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment