Archive for January, 2009

Search and Replace on command-line for several files

Wednesday, January 7th, 2009 | Permalink

Here is a little helper which can be used to search and replace Words in several files at one time.
For this we use perl on the command-line.
perl -p -i.bak -e "~s|search|replace|" file1.txt file2.txt file3.txt
The system will add a .bak file for each file so you have the old stuff too.

Getting Mac OS X in Standby with Shell Command

Wednesday, January 7th, 2009 | Permalink

Sometimes you leave the house and you Mac has to run for a little while, but then you want it in standby.
Here is a easy way to do this with a shell command.

sleep 900 && osascript -e 'tell app "Finder" to sleep'

This sets a 900 seconds (15 minutes) waiting time before putting the Mac into the sleep mode.