Using find

When not using ack, my favorite search tool, you can still exclude SVN folders. Here is an example of me looking for a file: $ find . -not \( -name .svn -prune \) -name ‘EosController*’ ./web/models/controllers/EosController.php ./web/models/controllers/EosControllerTest.php This mode of expression might be better for your scripting needs.

unix search-and-replace: rpl (and sed)

Evan showed the world his “weak Ruby script” to find-and-replace in multiple files, and was pointed to the amazing rpl utility. Let’s see what the port maintainer has written about the rpl tool. $ port info rpl rpl 1.4.0, textproc/rpl (Variants: universal) http://www.laffeycomputer.com/rpl.html rpl is a Unix text replacement utility. It will replace strings with …

Snippet: remove .svn directories

Snippet to recursively drop Subversion control of a directory. It removes the .svn directories, and their contents. find . -name “.svn” -exec rm -rf {} \; Credit: Zed Shaw, at the Mongrel mailing list. (Note to contemporary readers: Crazy old info) Oh, and if you are using Mongrel, and need help with it, there is …

bash functions example

Bradley Taylor (of [Railsmachine](http://railsmachine.com/) hosting fame) said this on [the excellent Mongrel mailing list](http://rubyforge.org/mailman/listinfo/mongrel-users): “Just use these bash functions and put them in your .bashrc:” cluster\_restart () { mongrel\_rails cluster::restart -C /etc/ mongrel\_cluster/$1.yml; } cluster\_start () { mongrel\_rails cluster::start -C /etc/ mongrel\_cluster/$1.yml; } cluster\_stop () { mongrel\_rails cluster::stop -C /etc/mongrel\_cluster/$1.yml; } usage: $ cluster_start fluxura …

Awk, text processing

Fooling around with load average output on a shared host (where it can be life-or-death): $ w -s|awk ‘/load average:/ { print “Load averages:\nPast 1 min: ” $10 “\nPast 5 min: ” $11 “\nPast 15 min: ” $12 }’ Load averages: Past 1 min: 20.94, Past 5 min: 20.67, Past 15 min: 18.75 What’s w, …