Two Useful Bash Commands to Find and Replace

Some useful shell commands I’ve been using lately.

First one does a print into console of all words match `/media/static` for files in the folder and below that ends with a html file type.

The second one finds all html file types and replaces /media/static/images/yellowcross.png with {% static ‘images/yellowcross.png’ %}

grep -rn "/media/static" . `find . -name "*html"`

find . -name "*.html" -print | xargs sed -i "" "s+/media/static/images/yellowcross.png+{% static 'images/yellowcross.png' %}+g"