Escaping the forward slash ‘/’ character with sed

A little known way to perform operations with sed is as follows

sed -e 's=old=new=g'

instead of the more typical

sed -e 's/old/new/g'

This is very usefuly for when you’re trying to make changes to/using strings that have forward slashes ‘/’ in them. When the = symbol is used with sed, the forward slash just becomes another ‘normal’ character in the operation.

Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress