Replace links in files with Regular Expressions

Published on

You need to replace a string with special characters (like http://) and don’t want to do that manually?

I’ve found the solution.


I tried to escape each ‘/’ with ‘/’ but sed didn’t like that.

Instead of replacing each ‘/’ just replace the placeholders for the regular expression with ‘#’!

Like this :

$ sed -i.bak s# *


  • -i.bak is need, to prevent sed to cry around, it will make a backup of the files that you can simply remove with rm *.bak

    • at the end means ‘search all files’

I found the solution on this [forum](

Here, have a slice of pizza 🍕