Bash function easily replace inline file | The Dev Tool | Toolel.com
function replacer {
echo Replacing "$1" with "$2" on file "$3"
FROM_REPLACE=$(printf '%s\n' "$1" | sed -e 's/[\/&]/\\&/g')
TO_REPLACE=$(printf '%s\n' "$2" | sed -e 's/[\/&]/\\&/g')
sed -i -e "s/$FROM_REPLACE/$TO_REPLACE/g" "$3"
}
# Use this by
replacer "what_to_replace" "what_to_replace_it_with" file.html
Created by: martin
Comments
This page is only partially working without JavaScript. It will show content, but the tools and interactivity cannot be shown without JavaScript enabled. Please enable JavaScript for this page. About Us