Whatever you do will be insignificant, but it is very important that you do it.
- Mahatma Gandhi

Thursday, July 23, 2009

Interesting Advice on Money Management

Found an interesting article today, which was linked off of lifehacker.
http://www.fivecentnickel.com/2009/07/22/save-money-by-questioning-your-purchases/
Sounds like a great idea that lots of us could benefit from. I know that I've certainly made purchases that within a few days I was wishing that I could have back. Anyway, I think this is a great idea that I'm going to try to implement in my life, and I hope it helps others as well.

Thursday, July 09, 2009

Renaming a Tool Suite

At work, we're generating a "next generation" set of tools. We wanted to create a new name to help differentiate the new tools from the old tools, but we also wanted to start with the same code base as the old tools. To accomplish this, we needed to change all references to the old name into the new name. To do this, I used the following commands:
This one finds the actual files and directories with the "Old" names and changes them:
for f in `find | grep Old`; do export A=`echo $f | sed 's:Old:New:g'`; mv $f $A; done;

The short explanation of this command is that it finds all files with Old in the filename, then determines what the filename would be replacing Old with New, and then moves the file. This may have to be run several times, since the parent directories may be renamed before the child directories are reached.

Then we had to replace all references to the Old tool name in the actual files:
find -exec sed -i "s:Old:New:g" {} \;

This just finds all files in your directory, and uses sed to do an "in place" substitution of Old with New.
Hope this is helpful to somebody!