Sunday, August 26, 2007

How to replace a string in all files

For instance you move all your source from Fedora to Ubuntu. The include file change from to

you need do this in the src directory
perl -pi -e "s/glpk\/glpk\.h/glpk\.h/g" *


General form is :
perl -pi -e "s/original/newpattern/g" *

No comments: