Find and replace a string in multiple files

Tips and tricks for bash. Examples and common scripts
fabiodelorenzo
Posts: 65
Joined: Thu Oct 03, 2013 5:54 pm

Find and replace a string in multiple files

Postby fabiodelorenzo » Sun Apr 06, 2014 9:56 pm

looking for to_be_replaced
replacing with new_string
for *.html files only :

Code: Select all

find . -type f -print0 | xargs -0 sed -i 's/to_be_replaced/new_string/g' *.html

Return to “Bash”

Who is online

Users browsing this forum: No registered users and 1 guest