<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Nachopp&#039;s Blog</title>
	<atom:link href="http://ignaciopp.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ignaciopp.wordpress.com</link>
	<description>notes and tidbits about emacs, gnu tools, web programming, and sysadmin related stuff</description>
	<lastBuildDate>Thu, 26 Jan 2012 13:51:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ignaciopp.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Nachopp&#039;s Blog</title>
		<link>http://ignaciopp.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ignaciopp.wordpress.com/osd.xml" title="Nachopp&#039;s Blog" />
	<atom:link rel='hub' href='http://ignaciopp.wordpress.com/?pushpress=hub'/>
		<item>
		<title>emacs using recode-region for encoding failures</title>
		<link>http://ignaciopp.wordpress.com/2012/01/23/emacs-using-recode-region-for-encoding-failures/</link>
		<comments>http://ignaciopp.wordpress.com/2012/01/23/emacs-using-recode-region-for-encoding-failures/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 21:07:05 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[ascii characters]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[multibyte characters]]></category>
		<category><![CDATA[org-mode]]></category>
		<category><![CDATA[text-editing]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=749</guid>
		<description><![CDATA[I had an encoding issue that was bugging me inside the remember-data-file. I don&#8217;t know exactly how some latin-1 characters copy-pasted there ended up being saved as raw-text and were shown like non-ASCII characters (so a multibyte characters like &#8220;é&#8221; will appear with it&#8217;s escaped octal code &#8220;303\251&#8243; ) I tried at first setting the file&#8217;s encoding [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=749&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had an encoding issue that was bugging me inside the remember-data-file. I don&#8217;t know exactly how some latin-1 characters copy-pasted there ended up being saved as raw-text and were shown like non-ASCII characters (so a multibyte characters like &#8220;é&#8221; will appear with it&#8217;s escaped octal code &#8220;303\251&#8243; )</p>
<p>I tried at first setting the file&#8217;s encoding system with the tag &#8220;-*-coding: utf-8 -*-&#8221;, though it seemed not sufficient. The raw characters remained there and I soon grew tired of having to type in: &#8220;<strong>utf-8</strong>&#8221; at the prompt to select the encoding every time I needed to save the file. </p>
<p>Today searching the manual found <a title="http://www.gnu.org/software/emacs/manual/html_node/emacs/Text-Coding.html" href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Text-Coding.html">here</a> one easy cure on the command &#8220;recode-region&#8221; which allows to convert the text that was decoded with the wrong coding system.</p>
<p>Really all it took after marking the whole buffer (C-x h) was doing: &#8220;M-x<strong> recode-region</strong> RET&#8221; &#8220;Text was was really in: <strong>utf-8</strong>&#8221; &#8220;But was interpreted as: <strong>raw-text&#8221;</strong></p>
<p>That was it!, the drag is over, I&#8217;m back to storing notes quickly doing just <strong>C-c r</strong> and <strong>C-c C-x</strong> with the worthy <a title="remember" href="http://www.emacswiki.org/emacs/RememberMode">remember </a>mode.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/749/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=749&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/01/23/emacs-using-recode-region-for-encoding-failures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>sed onliner to join lines broken by a single linefeed</title>
		<link>http://ignaciopp.wordpress.com/2011/09/26/sed-onliner-to-joing-lines-broken-by-a-single-carriage-return/</link>
		<comments>http://ignaciopp.wordpress.com/2011/09/26/sed-onliner-to-joing-lines-broken-by-a-single-carriage-return/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 15:00:20 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[text-editing]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=731</guid>
		<description><![CDATA[(This is mainly a remainder post for myself) For certain reasons I sometimes have to edit text pasted from an emacs buffer that I was editing with the longlines-mode enabled. Hence as this mode does, the paragraphs are hard wrapped beyond a certain amount of characters (when they extend over &#8216;fill-column&#8217; lenght). Although &#8220;the soft [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=731&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>(This is mainly a remainder post for myself)<br />
For certain reasons I sometimes have to edit text pasted from an emacs buffer that I was editing with the <a href="http://www.gnu.org/s/libtool/manual/emacs/Longlines.html" title="longlines-mode">longlines-mode</a> enabled. Hence as this mode does,  the paragraphs are hard wrapped beyond a certain amount of characters (when they extend over &#8216;fill-column&#8217; lenght). </p>
<p>Although &#8220;the soft newlines used for line wrapping will not show up when the text is yanked or saved to disk&#8221;, they will remain if, say, I had carelessly pasted it directly into a gmail form to save for later reuse there. </p>
<p>My way to remove those artificially-inserted line breaks, is running this oneliner on the text region. </p>
<pre style="color:#ffffff;background-color:#124368;font-size:8pt;padding:4px;">
sed <span style="color:#ff7f24;">-ne</span> '1h;1!H;${;g;s#\n\([^\n]\)# \1#g;p}' | sed <span style="color:#ff7f24;">-e</span> 's#^[ \t]*\(.*\)$#\1#g'</pre>
<p>(The first sed command tells to put a space and remove the line break. using the multiline search and replace <a href="http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/" title="method">method </a><br />
The second just gets rid of the leading white space at the beginning of line)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/731/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=731&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/09/26/sed-onliner-to-joing-lines-broken-by-a-single-carriage-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>elisp function to insert heredoc parameters for shell according to hostname</title>
		<link>http://ignaciopp.wordpress.com/2011/09/25/elisp-function-to-insert-heredoc-parameters-for-shell-according-to-hostname/</link>
		<comments>http://ignaciopp.wordpress.com/2011/09/25/elisp-function-to-insert-heredoc-parameters-for-shell-according-to-hostname/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 21:10:49 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[dot-emacs]]></category>
		<category><![CDATA[elisp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=714</guid>
		<description><![CDATA[Now that I&#8217;m getting fond of using a heredoc to insert mysql scripts into the bash shell, have put this into my emacs initialization file. The same shortcut (Control+Shift+f11) will conveniently write different parameters depending in which shell I&#8217;m sitting in. UPDATE: seems that I spoke too soon. Asking about the present working directory, formerly [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=714&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Now that I&#8217;m getting fond of <a title="using a heredoc to insert mysql scripts into the bash shell" href="http://ignaciopp.wordpress.com/2011/08/08/heredoc-tip-execute-mysql-commands-from-shell-with-multiline-scripts-or-queries/">using a heredoc to insert mysql scripts into the bash shell</a>, have put this into my emacs initialization file. The same shortcut (Control+Shift+f11) will conveniently write different parameters depending in which shell I&#8217;m sitting in.</p>
<p>UPDATE: seems that I spoke too soon. Asking about the present working directory, formerly &#8220;(let ((a (shell-command-to-string &#8220;pwd | tr -d &#8216;\\n&#8217;&#8221;)))&#8221;, didn&#8217;t actually work when having opened shells of different servers via Tramp.<br />
The correction below (less elegant) depends on the shell buffer being created/renamed with an identifiable name -which could be the hostname or whatever consistent nomenclature we choose-.<br />
Anyway, until figuring a better way, this does the job of inserting the right parameters into each shell:</p>
<pre style="color:#f5f5f5;background-color:#212121;overflow:auto;font-size:8pt;border-color:#424242;border-style:solid;border-width:1px 1px 0;padding:4px;"><span style="color:#00ffff;">(defun</span> <span style="color:#87cefa;">my-heredoc-sql-invocation-from-shell</span> ()
<span style="color:#ffa07a;">"Insert the appropiate parameters to run a heredoc mysql query depending on which shell I'm in"</span>
  (interactive)
  (<span style="color:#00ffff;">let</span> ((a (buffer-name (window-buffer (minibuffer-selected-window))))
        (b nil))
    (<span style="color:#00ffff;">cond</span> ((string-match <span style="color:#ffa07a;">"serverA"</span> a)
           (setq b <span style="color:#ffa07a;">"mysql -uroot mainDbToHitAt_A--password=`cat /etc/security/mysqlpassword` -t -vv &lt;&lt;\\!"</span>))
          ((string-match <span style="color:#ffa07a;">"serverB"</span> a)
           (setq b <span style="color:#ffa07a;">"mysql -ualpha mainDbToHitAt_B --password=`cat /etc/security/mysqlpassword` -t -vv &lt;&lt;\\!"</span>))
          ((string-match <span style="color:#ffa07a;">"serverC"</span> a)
           (setq b <span style="color:#ffa07a;">"mysql -uroot mainDbToHitAt_C  -t &lt;&lt;\\!"</span>)))
    (insert b)))

<span style="color:#ff7f24;">;; </span><span style="color:#ff7f24;">key shortcut to bind it to
</span>(global-set-key (kbd <span style="color:#ffa07a;">"C-S-&lt;f11&gt;"</span>)  'my-heredoc-sql-invocation-from-shell)
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/714/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/714/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/714/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/714/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/714/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/714/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/714/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/714/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/714/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/714/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/714/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/714/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/714/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/714/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=714&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/09/25/elisp-function-to-insert-heredoc-parameters-for-shell-according-to-hostname/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>heredoc tip, execute mysql commands from shell with multiline scripts or queries</title>
		<link>http://ignaciopp.wordpress.com/2011/08/08/heredoc-tip-execute-mysql-commands-from-shell-with-multiline-scripts-or-queries/</link>
		<comments>http://ignaciopp.wordpress.com/2011/08/08/heredoc-tip-execute-mysql-commands-from-shell-with-multiline-scripts-or-queries/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 21:46:58 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=669</guid>
		<description><![CDATA[Despite being dealing with databases for some years it was just recently that I started to run mysql queries straight from the shell by doing something like: mysql -u(user) -p(password)  -t -e &#8216;whatever sql query here in one line&#8217; Although a handy way to use every now and then, I still felt this sort of limited since [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=669&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Despite being dealing with databases for some years it was just recently that I started to run mysql queries straight from the shell by doing something like:</p>
<div style="color:#000;overflow:auto;border:1px solid gray;background:#dedede;padding:4px;">
mysql -u(user) -p(password)  -t -e &#8216;whatever sql query here in one line&#8217;
</div>
<p style="margin-top:22px;">Although a handy way to use every now and then, I still felt this sort of limited since the query to be passed in the &#8220;-e&#8221; argument must go inside a single line. In search of  a better alternative I was pleased to figure instead that it&#8217;s possible to combine heredoc sintaxis with the sql execution in the command line. <a title="Heredoc" href="http://en.wikipedia.org/wiki/Here_document">Heredoc </a> is a mechanism to break text into multiple lines, just as a file would be treated, after the &#8220;&lt;&lt;&#8221; sign, the parser says: &#8220;here follows a document&#8221; which gets wrapped inside the pair of whatever text delimeters we choose. The obvious convenience is that without having to create a file we could easily run multiline queries -which read more naturally with line breaks and indentation- in the same way we would write them inside a file.</p>
<p style="text-align:left;">To quickly see what I&#8217;m talking about type</p>
<div style="color:#000;overflow:auto;border:1px solid gray;background:#dedede;padding:4px;">
mysql -u(yourDatabaseUserName) -p(your Password)   -t&lt;&lt;eof<br />
show databases<br />
eof
</div>
<p style="margin-top:22px;">Now hit &#8220;Control D&#8221; and then, &#8220;Enter&#8221; to see the output directly thrown at your shell</p>
<p>To speed things up, since  I use the shell inside emacs, I bound the following to C-S f11 adding  what is below into my .emacs file:</p>
<div style="color:#000;overflow:auto;border:1px solid gray;background:#dedede;padding:4px;">
<p style="text-align:left;">(set-register ?q &#8220;mysql -u kabul -p ******** -t &lt;&lt;eofsql&#8221;)<br />
(defalias &#8216;Q<br />
(read-kbd-macro &#8220;M-x insert-register RET Q C-e &#8220;))<br />
(global-set-key [C-S-f11] &#8216;Q)</p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/669/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=669&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/08/08/heredoc-tip-execute-mysql-commands-from-shell-with-multiline-scripts-or-queries/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>how to save output of a sql query to comma separated value (CSV)</title>
		<link>http://ignaciopp.wordpress.com/2011/08/08/how-to-save-output-of-a-sql-query-to-comma-separated-value-csv/</link>
		<comments>http://ignaciopp.wordpress.com/2011/08/08/how-to-save-output-of-a-sql-query-to-comma-separated-value-csv/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 21:36:49 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[tabs]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=681</guid>
		<description><![CDATA[In a bash shell, I knew about the way to produce the output of a query into a tab delimited file by simply running: mysql -uUSER -pPASSW &#60; fileWithSQLquery.sql &#62; fileToSave.tab Now in this case what I needed was a CSV file, for which I piped it to sed reeplacing tabs by commas doing: mysql -uUSER [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=681&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In a bash shell, I knew about the way to produce the output of a query into a tab delimited file by simply running:</p>
<div style="color:#000;overflow:auto;border:1px solid gray;background:#dedede;padding:4px;">
mysql -uUSER -pPASSW &lt; fileWithSQLquery.sql &gt; fileToSave.tab
</div>
<p style="margin-top:22px;">Now in this case what I needed was a CSV file, for which I piped it to sed reeplacing tabs by commas doing:</p>
<div style="color:#000;overflow:auto;border:1px solid gray;background:#dedede;padding:4px;">
mysql -uUSER -pPASSW &lt; fileWithSQLquery.sql | sed -e &#8216;s#\t#, #g&#8217; &gt; fileToSave.csv
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/681/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=681&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/08/08/how-to-save-output-of-a-sql-query-to-comma-separated-value-csv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>php in the command line trick</title>
		<link>http://ignaciopp.wordpress.com/2011/05/18/php-in-the-command-line-trick/</link>
		<comments>http://ignaciopp.wordpress.com/2011/05/18/php-in-the-command-line-trick/#comments</comments>
		<pubDate>Wed, 18 May 2011 00:34:53 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=655</guid>
		<description><![CDATA[here&#8217;s an example of how to run php in the command line, something I almost never do and would like to remember by writing it down. Simply echo the php statement (within its corresponding tags) and pipe it to the php service. Eg: echo &#8216;&#60;?php $str = &#8217;2144338&#8242;; echo substr($str,0,2); ?&#62;&#8217; &#124; php or even [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=655&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>here&#8217;s an example of how to run php in the command line, something I almost never do and would like to remember by writing it down.<br />
Simply echo the php statement (within its corresponding tags) and pipe it to the php service. Eg:</p>
<div style="color:#000;overflow:auto;border:1px solid gray;background:#dedede;padding:4px;">echo &#8216;&lt;?php $str = &#8217;2144338&#8242;; echo substr($str,0,2); ?&gt;&#8217; | php</div>
<p>or even more usefully:</p>
<div style="color:#000;overflow:auto;border:1px solid gray;background:#dedede;padding:4px;">echo &#8216;&lt;?php  phpinfo(); ?&gt;&#8217; | php</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/655/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=655&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/05/18/php-in-the-command-line-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>how to find files within time range</title>
		<link>http://ignaciopp.wordpress.com/2011/04/13/how-to-find-files-within-time-range/</link>
		<comments>http://ignaciopp.wordpress.com/2011/04/13/how-to-find-files-within-time-range/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 20:14:59 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[gnu]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=650</guid>
		<description><![CDATA[I sometimes forget about the exact name of a file I was working a while ago. Luckily the way to state a range of time with find is quite intuitive; say that we want to see the files modified in a lapse of 14 days starting from a week ago: find . -ctime +7 -ctime [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=650&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I sometimes forget about the exact name of a file I was working a while ago. Luckily the way to state a range of time with find is quite intuitive; say that we want to see the files modified in a lapse of 14 days starting from a week ago:</p>
<pre style="color:#000;background-color:#dedede;border:1px solid #424242;font-size:8pt;overflow:auto;padding:4px;">find . -ctime +7  -ctime -21 # (older than 7 days but newer than three weeks ago)
</pre>
<p>There are simply 3 options of numeric arguments for time</p>
<ol>
<li>+n &#8211;&gt; More than &#8216;n&#8217; days ago.</li>
<li> -n &#8211;&gt; Less than &#8216;n&#8217; days ago.</li>
<li> n &#8212;&gt; Exactly &#8216;n&#8217; days ago.</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/650/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/650/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/650/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/650/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/650/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/650/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/650/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/650/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/650/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/650/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/650/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/650/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/650/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/650/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=650&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/04/13/how-to-find-files-within-time-range/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>how to restore data of a single table from a complete mysql dump</title>
		<link>http://ignaciopp.wordpress.com/2011/03/12/how-to-restore-data-of-a-single-table-from-a-complete-mysql-dump/</link>
		<comments>http://ignaciopp.wordpress.com/2011/03/12/how-to-restore-data-of-a-single-table-from-a-complete-mysql-dump/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 19:35:07 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[restoration]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[sys-admin]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=629</guid>
		<description><![CDATA[I struggled the other day doing some sys admin work for recovering data from a single table of our database. Editing big files (of about several gigabites) is no-picnic even for vi(m) or emacs, so it wasn&#8217;t trivial to find a quick way to isolate the parts needed. For what is worth here&#8217;s the method [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=629&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I struggled the other day doing some sys admin work for recovering data from a single table of our database. Editing big files (of about several gigabites) is no-picnic even for  vi(m) or emacs, so it wasn&#8217;t  trivial to find a quick way to isolate the parts needed. For what is worth here&#8217;s the method I&#8217;ve followed with success resourcing to simple cat and sed commands in my command line: </p>
<ol>
<li style="margin-top:22px;">
Get the creation  statement for the table to be recovered</p>
<pre style="color:#000;background-color:rgb(233,233,233);border:1px solid rgb(66,66,66);font-size:8pt;overflow:auto;padding:4px;">cat your_entire_backup_file.sql | sed -ne '/Table structure for table `your_table`/,/-- Dump/p' &gt; table_creation.sql
</pre>
</li>
<li style="margin-top:22px;">
Get the data</p>
<pre style="color:#000;background-color:rgb(233,233,233);border:1px solid rgb(66,66,66);font-size:8pt;overflow:auto;padding:4px;">cat your_entire_backup_file.sql | sed -ne '/INSERT INTO `your_table`/,/Table structure/p' &gt; data_dump.sql
</pre>
</li>
<li style="margin-top:22px;">
Join the two into a single file</p>
<pre style="color:#000;background-color:rgb(233,233,233);border:1px solid rgb(66,66,66);font-size:8pt;overflow:auto;padding:4px;">cat table_creation.sql data_dump.sql &gt; data_for_single_table_to_copy
</pre>
</li>
<li style="margin-top:22px;">
Optionally, in case you need to extract some rows only from that previous instance of the table, as it was my case with records deleted by mistake, you might want to create a temporary table from where to later perfom the selection of the desired rows. In order to do that, the table name should be altered from the creation and insertion statements: </p>
<pre style="color:#000;background-color:rgb(233,233,233);border:1px solid rgb(66,66,66);font-size:8pt;overflow:auto;padding:4px;">sed -i 's#your_table#your_temp_table#g' data_for_single_table_to_copy.sql
</pre>
</li>
<li style="margin-top:22px;">
Now we are ready to create that temporary table with its data inside our database:</p>
<pre style="color:#000;background-color:rgb(233,233,233);border:1px solid rgb(66,66,66);font-size:8pt;overflow:auto;padding:4px;">mysql -u 'your_username -p your_database_name &lt; &#039;your_path_to_the_file/data_for_single_table_to_copy.sql
</pre>
</li>
<li style="margin-top:22px;margin-bottom:48px;">
Voila!, the table is there containing the information you needed. Now is up to you to extract and reinsert whatever you wanted inside the original table</li>
</ol>
<p><strong>Note: </strong>See that different parameters could  be used to isolate and put together table creation and data parts in only one pass. Also the awk command  might be used instead since, like sed, it permits collecting portions by matching from the beginning to the ending block of text. Just make sure you know the order of the table after the one you are picking. </p>
<pre style="color:#000;background-color:rgb(233,233,233);border:1px solid rgb(66,66,66);font-size:8pt;overflow:auto;padding:4px;">awk '/Table structure for table `your_table`/,/Table structure for table `your_next_table`/{print}' your_entire_backup_file.sql &gt; data_for_single_table_to_copy.sql
</pre>
<p>In case the table to extract happens to be the last one (which again, you could just know with a mysq &#8220;show tables&#8221; command, modify the last part of the regexp to match it accordingly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/629/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=629&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/03/12/how-to-restore-data-of-a-single-table-from-a-complete-mysql-dump/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>finding ways to backup sites over ssh</title>
		<link>http://ignaciopp.wordpress.com/2010/12/27/finding-ways-to-backup-sites-over-ssh/</link>
		<comments>http://ignaciopp.wordpress.com/2010/12/27/finding-ways-to-backup-sites-over-ssh/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 15:33:09 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[gnu]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[cpio]]></category>
		<category><![CDATA[mirroring]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=611</guid>
		<description><![CDATA[Having discovered the command cpio (wich acts like tar but preserving symbolic links) to recursively put into a single file all the directory structure and files of an entire website, I started to explore its use along with other ways to securely move files between hosts. The command rsync seems like an extraordinary find in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=611&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Having discovered the command cpio (wich acts like tar but preserving symbolic links) to recursively put into a single file all the directory structure and files of an entire website,  I started to explore its use along with other ways to securely move files between hosts. The command rsync seems like an extraordinary find in that regard.</p>
<p>Here are some neat examples for backing up (or mirroring) sites with ssh I don&#8217;t want to miss: </p>
<blockquote><p>There&#8217;s a really easy way to make a remote directory be an exact  match of a local directory via an ssh connection. And that&#8217;s to use rsync to do the job. It&#8217;s smart and only sends enough data to sync the remote dir to the local one. Assuming that you have a local dir named master-copy and the remote system&#8217;s repository is in a directory named slave-copy you&#8217;d do:</p>
<p><code>rsync --rsh=ssh --delete -Cav master-copy/* user-name@remote.dom.tld:/path-to/slave-copy</code></p>
<p>That command will recursively sync everything found in master-copy to the remote. Any files found on the remote that aren&#8217;t in master-copy or one of its sub-dirs will be deleted from master-copy. Only changed or new files will be transferred to the remote.
</p></blockquote>
<p>to which another expert adds:</p>
<blockquote><p>The rsync idea is good &#8212; but I for my part always try NOT to install any additional software not essentially required. Today, ssh is &#8220;a must&#8221; on most systems and you can go with the  cpio approach I&#8217;ve mentioned.<br />
I must admit the rsync thing is transferring less data if stuff is already on the target side, but this is not the case when running<br />
<code>source=/var/tmp ; target=/var/backup<br />
 cd $source ; find . -mtime -1 -type f -print | cpio -ocB | ssh -l username host-b "cd $target ; cpio -icBduml"</code><br />
daily.
</p></blockquote>
<p>Another suggestion to copy the entire directory tree at /some/path to other.host via SSH is to do: </p>
<blockquote><p><code>find /some/path -print | sort | cpio -o -Hnewc | ssh -C other.host "cpio -idvum"</code></p></blockquote>
<p>Finally, there&#8217;s more to chew with this thorough example on how to mirror a site with rsync <a href="//www.askapache.com/security/mirror-using-rsync-ssh.html">http://www.askapache.com/security/mirror-using-rsync-ssh.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/611/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=611&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2010/12/27/finding-ways-to-backup-sites-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>a killer .htaccess article</title>
		<link>http://ignaciopp.wordpress.com/2010/12/27/a-killer-htaccess-article/</link>
		<comments>http://ignaciopp.wordpress.com/2010/12/27/a-killer-htaccess-article/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 14:49:33 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=608</guid>
		<description><![CDATA[Found this gem , with about all you need to know for setting the apache directives on websites. From the same guy that knows his stuff, this note http://www.askapache.com/security/mirror-using-rsync-ssh.html on using the powerful rsync command<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=608&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Found this <a href="http://www.askapache.com/htaccess/htaccess.html">gem </a>, with about all you need to know for setting the apache directives on websites.<br />
From the same guy that knows his stuff, this note <a href="http://www.askapache.com/security/mirror-using-rsync-ssh.html">http://www.askapache.com/security/mirror-using-rsync-ssh.html</a> on using the powerful rsync command</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ignaciopp.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ignaciopp.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ignaciopp.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ignaciopp.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ignaciopp.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ignaciopp.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ignaciopp.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ignaciopp.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ignaciopp.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ignaciopp.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ignaciopp.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ignaciopp.wordpress.com/608/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&amp;blog=7647034&amp;post=608&amp;subd=ignaciopp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2010/12/27/a-killer-htaccess-article/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
	</channel>
</rss>
