Saturday, April 30, 2011

Using Find and Replace on MacOSX

Terminal - Multiple Find / Replace

If you want to take a walk on the geek side, try popping open terminal from spotlight. I recently needed to parse a webarchive to find and replace absolute paths with relative paths. Ultimately the following worked:

find . -name "*.htm*" -exec  sed -ie 's/href="\//href=".\//g' {} \;

Using terminal one can issue many Unix commands. One way to get help is to type the 'man' - short for manual and the name of the command:

So in the instance above, one  might type:

man find (shows the manual page for find)
man sed (shows the manual page for stream editor)

0 comments:

Welcome to my Circle

It's amazing what one can do in this world. The ability to take the trivial and turn it inside out so that we are seeing not what is or what was, but what might have been. A journey of 1000 steps begins with one.

Light a candle and step into my circle.

燃點蠟燭,並加強到我的圈子

(z) (j)(f)(l)
Loading...