<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Hardcastle &#187; sed</title>
	<atom:link href="http://chrishardcastle.co.uk/tag/sed/feed" rel="self" type="application/rss+xml" />
	<link>http://chrishardcastle.co.uk</link>
	<description>Techical developer for websites in London</description>
	<lastBuildDate>Wed, 14 Oct 2009 20:26:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress absolute path update</title>
		<link>http://chrishardcastle.co.uk/wordpress-absolute-path-update</link>
		<comments>http://chrishardcastle.co.uk/wordpress-absolute-path-update#comments</comments>
		<pubDate>Tue, 30 Jun 2009 21:47:42 +0000</pubDate>
		<dc:creator>chris.hardcastle</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://chrishardcastle.co.uk/?p=53</guid>
		<description><![CDATA[I have just found a really helpful command that I can see myself using all the time. It&#8217;s too often that I need to take a copy of a development database file and update the absolute paths to use the live address.

Imagine you have a .sql file that you have created by exporting a wordpress [...]]]></description>
			<content:encoded><![CDATA[<p>I have just found a really helpful command that I can see myself using all the time. It&#8217;s too often that I need to take a copy of a development database file and update the absolute paths to use the live address.<br />
<span id="more-53"></span><br />
Imagine you have a .sql file that you have created by exporting a wordpress database. That can be done using the mysqldump command over the command line in Linux/Ubuntu. Now you want to replace all (global) occurrences of &#8220;local&#8221; with &#8220;live&#8221; in a file called &#8220;data.sql&#8221; and catch the results in a new file called &#8220;new.sql&#8221; the code would be as follows.</p>
<p><code><br />
sed -e 's/local/live/g' data.sql > new.sql</p>
<p></code><br />
A new file should be created called &#8220;new.sql&#8221; with the replacements made. SED is a tool available in all Linux distributions and can be accessed via the command line. The &#8220;e&#8221; command runs the function with the script that follows in quotes. The &#8217;s&#8217; command treats the arguments as separate files. The &#8216;g&#8217; means global. This makes a replacement on multiple lines.</p>
<p>This is an interpretation based on guidance from this<a href="http://www.ibm.com/developerworks/linux/library/l-sed2.html"> following article</a> it&#8217;s a very simple example. For my own reference really, but I hope you find useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrishardcastle.co.uk/wordpress-absolute-path-update/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
