Last Updated: February 25, 2016
·
674
· buithehoa

Replace a String in Multiple Files Using grep and sed

grep -rl 'matching_string' some_directory/ | xargs sed -i 's/matching_string/new_string/g'

Sample:

$ grep -rl 'fileItems' app/assets/javascript/ | xargs sed -i 's/fileItems/fileItemList/g'