After Googling for a bit, the easiest solution I could find uses find and sed. Here it is:
find ./ -type f -exec sed -i ’s/oldstring/newstring/’ {} \;
That will edit all the files in place and will NOT create backups so buyer beware.
Source
Every now and then I’ll have to search through a 10MB or 20MB SQL dump for something, and historically I’ve just used Gedit for this, even though it can take minutes to open it and scrolling is pretty much unusable.
Today, I discovered that if all you’re doing is viewing it and searching it, then less is definitely the way to go. It opens instantly and you can use vim syntax to search through it. Try it:
less your_huge_file.txt
Then just type /searchterm and hit enter to search, then n to cycle through the results.
It’s relatively easy to use CVS to keep Drupal core up to date. Here’s a quick guide.
To install core:
$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-6-14 -d directory_name drupal
When doing the above, change 6-14 to the Drupal version you want to check out (obviously using X-X syntax instead of X.X), and change directory_name to the path to the directory where you want it to download.
When it comes time to update, navigate to the site root and run:
$ cvs update -dP -r DRUPAL-6-15
Just change 6-15 to the version you’re updating to.
And of course, don’t forget to run your site’s update.php after these updates are done to keep your database in the game.
Bonus tip: since we all tend to do updates more than we do installs, I added this to my .bashrc file:
alias drupdate="cvs update -dP -r"
(Make sure that after you edit the file, you run bash so that it gets loaded.)
With this alias, you can navigate to your site root (assuming it’s already running off of CVS), and update it using a simple;
$ drupdate DRUPAL-6-15
I’ve been using a horrific monstrosity of a find command for this, and I just found out that grep can handle this by itself. Watch:
grep -rl 'your pattern' your_directory
For example, say you’re in the web root and you need to find every file which calls a certain function. You’d run:
grep -rl 'function_name' *
So easy. I’m so dumb.
By the way, the ‘-r’ makes it recursive and the ‘-l’ makes it just list the filename (instead of the filename and the context of the match).