2012年9月25日星期二

Find and replace a word in all the text document

So some day I need to replace a word to another one for all the XML file in a folder. I was like OK I'll write a C++ code. There goes another hour of my working time then.

Then I received this piece of code from a colleague:
find . -name "*.xml" -exec perl -pi.org -e 's/DICOMIO/CartoXP/' {} \;

Works like a charm.

Also, a linux command line to check how many cores do you have:
cat /proc/cpuinfo | grep processor | wc -l