Archive for January, 2009

07
Jan

Search and Replace on command-line for several files

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.

  • Share/Bookmark
07
Jan

Getting Mac OS X in Standby with Shell Command

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.
Open a terminal window and type in the following:

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.

  • Share/Bookmark