Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using sed to replace URL

Tags:

syntax

bash

sed

I'm having some trouble using sed to replace a string in an sql file. So far I have:

sed -i 's#http://mydomainurl.co.uk#http://pinkiepie#g' /home/user/dbs/my_database.sql

Whenever I run this it does remove http://mydomainurl.co.uk but replaces it with http://pinkiepie.co.uk The local machine at home is called pinkiepie, so doesn't need a TLD .co.uk suffix, so it should replace it with http://pinkiepie

Any idea where I'm going wrong here?

like image 488
tinyhammers Avatar asked Sep 18 '25 23:09

tinyhammers


1 Answers

sed -i 's,http://localhost:3000/,https://anywebsite.io/,g' ./destination

most easy solution

like image 134
x-magix Avatar answered Sep 20 '25 15:09

x-magix