Benoît Raux yet another php coder

Chef de projet developpeur web lyonnais #geek #apero #ski #sun #php #linux #shell #dev #web

[shell] string replace in all file recursively

Jan 21st, 2010 @ 10:37 am

Replace all occurrences of the EXPR_SEARCH expression with the EXPR_REPLACE expression in all files of DIRECTORY_PATH recursively

	sed -i -e 's/EXPR_SEARCH/EXPR_REPLACE/g' `grep -lR 'EXPR_SEARCH' DIRECTORY_PATH`

Note : don’t forget to escape special characters in your expression (ie : ‘images/site’ will be ‘images\/site’ )

Tweet

blog comments powered by Disqus
Comments

Archive · Mobile · RSS · twitter · cv