Links replacement on sql dump


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Links replacement on sql dump
# 1  
Old 10-07-2013
Links replacement on sql dump

Hi All
I have dump of mysql DB (Joomla), and I found out that there is absolute links on the DB not with the domain name but the IP address ex:

Code:
,(115205,'http://54.5.17.148//index.php/restoflink
,(115205,'http://54.5.17.149/index.php/restoflink,(115205,'http://54.5.17.149/index.php/restoflink.....

There is two IP's always in the absolute links because the website is behind a load balancer, the issue caused showing the IP address instead of the domain name in the browser URL bar.
I checked the absolute links with the IP and I found that there is four possibilities :
Code:
http://54.5.17.148//
http://54.5.17.148/
http://54.5.17.149/
http://54.5.17.149//

What's the right way to replace those links with the domain name instead ?,

thanks. in advance.
# 2  
Old 10-07-2013
Are those actual values in a table or they actually commented out in the dump file?

What do those names resolve to?
# 3  
Old 10-07-2013
Where do you want those links replaced? In the DB? In the dump file?
# 4  
Old 10-08-2013
those value are not commented but exist in the DB tables.
The name are the two IP servers because behind the load balancer.
I want to replace on the dump file then I will import it to DB.
# 5  
Old 10-08-2013
Try
Code:
sed -r 's#/+54.5.17.14[89]/+#/domain.com/#g' file
,(115205,'http:/domain.com/index.php/restoflink
,(115205,'http:/domain.com/index.php/restoflink,(115205,'http:/domain.com/index.php/restoflink.....

This User Gave Thanks to RudiC For This Post:
# 6  
Old 10-08-2013
thanks this is work for the two IP I posted but actually the real IP looks like this:
55.58.26.211
55.58.16.247
how I can modify the cmd to support those exact two IPs ?
# 7  
Old 10-08-2013
What about applying some creativity yourself?
And, why didn't you post the real IP in the first place?
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sql dump file - how to get certain values using sed

Hi, I have a dumpfile.sql - ========Start of file================= CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysql` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE TABLE `test_table1` ( `id` int ) AUTO_INCREMENT=12 CREATE TABLE `test_table2` ( `id` int ) AUTO_INCREMENT=120... (5 Replies)
Discussion started by: ashokvpp
5 Replies

2. AIX

List all the soft links and hard links

Hi I'm logged in as root in an aix box Which command will list all the soft links and hard links present in the server ? (2 Replies)
Discussion started by: newtoaixos
2 Replies

3. Solaris

Hard Links and Soft or Sym links

When loooking at files in a directory using ls, how can I tell if I have a hard link or soft link? (11 Replies)
Discussion started by: Harleyrci
11 Replies

4. Shell Programming and Scripting

"links -dump" output format issue

Hi All, I tried searching a lot about this but to no avail. I have a HTML file. I used links -dump file_page.html > text_html.txt What the above command gave me was a filtered text from the HTML file with tags removed. Now, the the output from the above command looked something like this:... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

5. Shell Programming and Scripting

how to break mysql dump sql file

Hi folks I have mysql dump which having insert queries, i want to break that file when 10 complete "INSERTS" lines so extract that line and store in 1.sql and 2.sql and for next 10 insert lines. pls guide me how can i do that. Regards, Bash (2 Replies)
Discussion started by: learnbash
2 Replies

6. Shell Programming and Scripting

use SQL loader to dump a fixed length file in to DB

consider a fixed length file 12345abcd8901 12345abcd7777 12345njdu8888 12345hdku8388 i would like to dump it in to oracle DB using sql loader 12345 in to first coloumn abcd in to second coloumn 8901 in to 3rd coloumn (2 Replies)
Discussion started by: anumkoshy
2 Replies

7. UNIX for Dummies Questions & Answers

help, what is the difference between core dump and panic dump?

help, what is the difference between core dump and panic dump? (1 Reply)
Discussion started by: aileen
1 Replies
Login or Register to Ask a Question