<?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>idv2 &#187; diff</title>
	<atom:link href="http://tech.idv2.com/tag/diff/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.idv2.com</link>
	<description>关注Web开发技术，关注Internet。</description>
	<lastBuildDate>Tue, 27 Jul 2010 12:54:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>diff命令的好用功能</title>
		<link>http://tech.idv2.com/2009/02/21/gnu-diff-tips/</link>
		<comments>http://tech.idv2.com/2009/02/21/gnu-diff-tips/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 15:57:54 +0000</pubDate>
		<dc:creator>charlee</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[diff]]></category>

		<guid isPermaLink="false">http://tech.idv2.com/2009/02/21/gnu-diff-tips/</guid>
		<description><![CDATA[<!-- begin Pukiwiki generated code--><p>GNU diff有很多功能平时我们不常用到，但若知道，在急需时还真能派得上用场。</p>
<p>最常用的功能莫过于生成patch文件了：</p>
<pre>diff -urN old/ new/ &gt; mysoft.patch</pre>
<p>参数 -u 表示使用 unified 格式，-r 表示比较目录，-N 表示将不存在的文件当作空文件处理，
这样新添加的文件也会出现在patch文件中。</p>
<p>然后在需要应用patch的地方使用下述命令即可：</p>
<pre>patch -p0 &lt; mysoft.patch</pre>
<p>diff的 -y 命令（长格式为 --side-by-side）可以将屏幕分成左右两部分，来比较两个文件之间的差异。
许多图形化的比较工具都有这个功能，但如果只能使用命令行，这个参数就相当有用了。
如果要改变左右各部分的宽度，可以通过 -W （--width）参数来指定。
（这条技巧来自于<a href="http://0xcc.net/blog/archives/000208.html">bkブログ</a>，谢谢）</p>
<p>此外，--strip-trailing-cr 参数可以去除行尾的换行，这样DOS格式和Unix格式的文件互相比较时，
就不至于因为换行符不一致而出现大量的差异。</p>
<!-- end Pukiwiki generated code-->]]></description>
			<content:encoded><![CDATA[<!-- begin Pukiwiki generated code--><p>GNU diff有很多功能平时我们不常用到，但若知道，在急需时还真能派得上用场。</p>
<p>最常用的功能莫过于生成patch文件了：</p>
<pre>diff -urN old/ new/ &gt; mysoft.patch</pre>
<p>参数 -u 表示使用 unified 格式，-r 表示比较目录，-N 表示将不存在的文件当作空文件处理，
这样新添加的文件也会出现在patch文件中。</p>
<p>然后在需要应用patch的地方使用下述命令即可：</p>
<pre>patch -p0 &lt; mysoft.patch</pre>
<p>diff的 -y 命令（长格式为 --side-by-side）可以将屏幕分成左右两部分，来比较两个文件之间的差异。
许多图形化的比较工具都有这个功能，但如果只能使用命令行，这个参数就相当有用了。
如果要改变左右各部分的宽度，可以通过 -W （--width）参数来指定。
（这条技巧来自于<a href="http://0xcc.net/blog/archives/000208.html">bkブログ</a>，谢谢）</p>
<p>此外，--strip-trailing-cr 参数可以去除行尾的换行，这样DOS格式和Unix格式的文件互相比较时，
就不至于因为换行符不一致而出现大量的差异。</p>
<!-- end Pukiwiki generated code-->]]></content:encoded>
			<wfw:commentRss>http://tech.idv2.com/2009/02/21/gnu-diff-tips/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
