Open cjmling opened 5 years ago
In case search and replace have /
character then we can change the deliminator.
example :
Find word http://
and replace with https://www.cyberciti.biz
:
sed 's/http:///https://www.cyberciti.biz/g' input.txt
(this will throw error)
can be written as
sed 's+http://+https://www.cyberciti.biz+g' input.txt
sed -i 's/old-text/new-text/g' input.txt
It tells sed to find all occurrences of ‘old-text’ and replace with ‘new-text’ in a file named input.txt
https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/