Tag Archives: unix

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 new strings in multiple text [...]
Posted in Technology | Also tagged | Leave a comment

List outdated port names with awk

MacPorts. Sometimes your ports are outdated. There’s a pseudo-portname for them. The report has many columns. And I only want the names, not their versions. port list outdated | awk 'BEGIN { RS="\n" } { print $1 }' > names_of_old_ports.txt Done. Update: got a bug, fixed it. Sheesh. [tags]awk,unix[/tags]
Posted in Technology | Also tagged | Leave a comment

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 a [...]
Posted in Technology | Also tagged , | Leave a comment

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: [...]
Posted in General | Also tagged | Leave a comment

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, you say? [...]
Posted in Technology | Also tagged , | Leave a comment