Affichage des articles dont le libellé est replace. Afficher tous les articles
Affichage des articles dont le libellé est replace. Afficher tous les articles

mardi 2 juin 2015

Replace all occurences of a string in a bunch of files by another string (in place)


  • Find all files on containing STRING_AAAA and replace it by STRING_BBBB in place (directly in the file).
find . -type f -exec grep -l STRING_AAAA {} \; -exec perl -pi -e 's!STRING_AAAA!STRING_BBBB!g' {} \;
Pre-tests :
  • Find all files on containing STRING_AAAA.
find . -type f -exec grep -l STRING_AAAA {} \;