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'
Written by Bui The Hoa
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#