<?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>天行健，君子以自强不息</title>
	<atom:link href="http://www.rickyzhu.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rickyzhu.com</link>
	<description>质量，数据库和我的生活</description>
	<lastBuildDate>Wed, 10 Mar 2010 04:41:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>UT江湖</title>
		<link>http://www.rickyzhu.com/2006_ut-2010.html</link>
		<comments>http://www.rickyzhu.com/2006_ut-2010.html#comments</comments>
		<pubDate>Wed, 10 Mar 2010 04:41:07 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[业界]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=2006</guid>
		<description><![CDATA[看着熟悉的office，熟悉的面孔，热情的场面
这个我曾经工作了4年多的地方，依然那么亲切
UT的江湖


2009年，UT斯达康可谓流年不利，杭州总部大楼的出售映衬了多年积弊。
2009年全年，UT斯达财报均报亏损，裁员重组。12月，UT斯达康把位于杭州滨江的大楼以9.5亿元的价格出售给中南建设集团。
今年年初，UT斯达康引进风险投资，已开始全面改革，“左拉广电，右牵亦庄”，只聚焦IPTV和宽带两大业务和中国、印度、日本三大市场，其余业务和人员重组。UT斯达康将把公司总部迁至北京，公司计划保留其在杭州和深圳的全部业务。
UT斯达康曾经是很多IT人员最向往的公司之一。视频展示了UT斯达康深圳研发中心2010年嘉年华，欢乐仍在。
UT斯达康员工、视频作者utshine表示：“怀念UT，UT是家好公司，国内少有的对员工的好公司，任何一个公司都有起有落，UT也一样。像任正非说的，只要保证灰度向前，就好了；简单一句话：对得住员工的公司就是好公司。”
2010年，新的开始。更多欢乐，还是更多痛苦……有些纤弱的花瓣，在缺少阳光的写字楼里，依然绽放出，羞涩的美丽。——UT斯达康员工对于当前的境况，自省与希望并存。
UT斯达康能否再现小灵通的神话？如同视频配乐所唱：“路途遥远，让我们在一起吧。”

via 
Related Posts新书推荐 (1)极速卡丁车 (0)从头开始 (15)地球一小时 (0)警惕短信新骗局 (6)什么是逻辑 (5)UT CEO敲响闭市钟声 (0)Google推出服务&#8221;狗屎&#8221; (0)全国哀悼日 (0)深圳宜家开张了 (2)]]></description>
			<content:encoded><![CDATA[<p>看着熟悉的office，熟悉的面孔，热情的场面<br />
这个我曾经工作了4年多的地方，依然那么亲切</p>
<p>UT的江湖</p>
<p><embed src="http://player.youku.com/player.php/sid/XMTU1NDE5MDI4/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed></p>
<blockquote>
<p>2009年，UT斯达康可谓流年不利，杭州总部大楼的出售映衬了多年积弊。</p>
<p>2009年全年，UT斯达财报均报亏损，裁员重组。12月，UT斯达康把位于杭州滨江的大楼以9.5亿元的价格出售给中南建设集团。</p>
<p>今年年初，UT斯达康引进风险投资，已开始全面改革，“左拉广电，右牵亦庄”，只聚焦IPTV和宽带两大业务和中国、印度、日本三大市场，其余业务和人员重组。UT斯达康将把公司总部迁至北京，公司计划保留其在杭州和深圳的全部业务。</p>
<p>UT斯达康曾经是很多IT人员最向往的公司之一。视频展示了UT斯达康深圳研发中心2010年嘉年华，欢乐仍在。</p>
<p>UT斯达康员工、视频作者utshine表示：“怀念UT，UT是家好公司，国内少有的对员工的好公司，任何一个公司都有起有落，UT也一样。像任正非说的，只要保证灰度向前，就好了；简单一句话：对得住员工的公司就是好公司。”</p>
<p>2010年，新的开始。更多欢乐，还是更多痛苦……有些纤弱的花瓣，在缺少阳光的写字楼里，依然绽放出，羞涩的美丽。——UT斯达康员工对于当前的境况，自省与希望并存。</p>
<p>UT斯达康能否再现小灵通的神话？如同视频配乐所唱：“路途遥远，让我们在一起吧。”</p>
</blockquote>
<p><a href="http://www.c114.net/news/128/a487278.html">via</a> </p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/1834_monito.html" title="新书推荐">新书推荐</a> (1)</li><li><a href="http://www.rickyzhu.com/912_karting-of-shenzhen.html" title="极速卡丁车">极速卡丁车</a> (0)</li><li><a href="http://www.rickyzhu.com/834_from-the-head.html" title="从头开始">从头开始</a> (15)</li><li><a href="http://www.rickyzhu.com/739_earth-hour.html" title="地球一小时">地球一小时</a> (0)</li><li><a href="http://www.rickyzhu.com/520_sms-trick.html" title="警惕短信新骗局">警惕短信新骗局</a> (6)</li><li><a href="http://www.rickyzhu.com/491_rabbit-story.html" title="什么是逻辑">什么是逻辑</a> (5)</li><li><a href="http://www.rickyzhu.com/468_ut-exit-nasdaq.html" title="UT CEO敲响闭市钟声">UT CEO敲响闭市钟声</a> (0)</li><li><a href="http://www.rickyzhu.com/466_goosh.html" title="Google推出服务&#8221;狗屎&#8221;">Google推出服务&#8221;狗屎&#8221;</a> (0)</li><li><a href="http://www.rickyzhu.com/462_weep-for-sichuan.html" title="全国哀悼日">全国哀悼日</a> (0)</li><li><a href="http://www.rickyzhu.com/454_ikea-is-opening.html" title="深圳宜家开张了">深圳宜家开张了</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/2006_ut-2010.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handy one-liners for awk</title>
		<link>http://www.rickyzhu.com/2003_handy-awk.html</link>
		<comments>http://www.rickyzhu.com/2003_handy-awk.html#comments</comments>
		<pubDate>Tue, 09 Mar 2010 06:09:18 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[脚本语言]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=2003</guid>
		<description><![CDATA[HANDY ONE-LINERS FOR AWK                                  22 July 2003
compiled by Eric Pement
           version 0.22
 [...]]]></description>
			<content:encoded><![CDATA[<p>HANDY ONE-LINERS FOR AWK                                  22 July 2003<br />
compiled by Eric Pement
<pemente @northpark.edu>           version 0.22<br />
   Latest version of this file is usually at:</p>
<p>http://www.student.northpark.edu/pemente/awk/awk1line.txt</p>
<p>USAGE:</p>
<p>    Unix:  awk &#8216;/pattern/ {print &#8220;$1&#8243;}&#8217;    # standard Unix shells<br />
 DOS/Win:  awk &#8216;/pattern/ {print &#8220;$1&#8243;}&#8217;    # okay for DJGPP compiled<br />
           awk &#8220;/pattern/ {print \&#8221;$1\&#8221;}&#8221;  # required for Mingw32</p>
<p>Most of my experience comes from version of GNU awk (gawk) compiled for<br />
Win32. Note in particular that DJGPP compilations permit the awk script<br />
to follow Unix quoting syntax &#8216;/like/ {&#8220;this&#8221;}&#8217;. However, the user must<br />
know that single quotes under DOS/Windows do not protect the redirection<br />
arrows (< , >) nor do they protect pipes (|). Both are special symbols<br />
for the DOS/CMD command shell and their special meaning is ignored only<br />
if they are placed within &#8220;double quotes.&#8221; Likewise, DOS/Win users must<br />
remember that the percent sign (%) is used to mark DOS/Win environment<br />
variables, so it must be doubled (%%) to yield a single percent sign<br />
visible to awk.</p>
<p>If I am sure that a script will NOT need to be quoted in Unix, DOS, or<br />
CMD, then I normally omit the quote marks. If an example is peculiar to<br />
GNU awk, the command &#8216;gawk&#8217; will be used. Please notify me if you find<br />
errors or new commands to add to this list (total length under 65<br />
characters). I usually try to put the shortest script first.</p>
<div class="dean_ch" style="white-space: wrap;">
<p>FILE SPACING:</p>
<p>
&nbsp;<span class="re3"># double space a file</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;1;{print &quot;&quot;}&#8217;</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;BEGIN{ORS=&quot;<span class="es0">\n</span><span class="es0">\n</span>&quot;};1&#8242;</span></p>
<p>&nbsp;<span class="re3"># double space a <span class="kw2">file</span> <span class="kw2">which</span> already has blank lines <span class="kw1">in</span> it. Output file</span><br />
&nbsp;<span class="re3"># should contain no <span class="kw2">more</span> than one blank line between lines of text.</span><br />
&nbsp;<span class="re3"># NOTE: On Unix systems, DOS lines <span class="kw2">which</span> have only CRLF <span class="br0">&#40;</span>\r\n<span class="br0">&#41;</span> are</span><br />
&nbsp;<span class="re3"># often treated <span class="kw2">as</span> non-blank, and thus </span><span class="st0">&#8216;NF&#8217;</span> alone will <span class="kw3">return</span> TRUE.<br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;NF{print $0 &quot;<span class="es0">\n</span>&quot;}&#8217;</span></p>
<p>&nbsp;<span class="re3"># triple space a file</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;1;{print &quot;<span class="es0">\n</span>&quot;}&#8217;</span></p>
<p>NUMBERING AND CALCULATIONS:</p>
<p>&nbsp;<span class="re3"># precede each line by its line number FOR THAT FILE <span class="br0">&#40;</span>left alignment<span class="br0">&#41;</span>.</span><br />
&nbsp;<span class="re3"># Using a tab <span class="br0">&#40;</span>\t<span class="br0">&#41;</span> instead of space will preserve margins.</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{print FNR &quot;<span class="es0">\t</span>&quot; $0}&#8217;</span> files*</p>
<p>&nbsp;<span class="re3"># precede each line by its line number FOR ALL FILES TOGETHER, with tab.</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{print NR &quot;<span class="es0">\t</span>&quot; $0}&#8217;</span> files*</p>
<p>&nbsp;<span class="re3"># number each line of a <span class="kw2">file</span> <span class="br0">&#40;</span>number on left, right-aligned<span class="br0">&#41;</span></span><br />
&nbsp;<span class="re3"># Double the percent signs <span class="kw1">if</span> typing from the DOS <span class="kw3">command</span> prompt.</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{printf(&quot;%5d : %s<span class="es0">\n</span>&quot;, NR,$0)}&#8217;</span></p>
<p>&nbsp;<span class="re3"># number each line of <span class="kw2">file</span>, but only print numbers <span class="kw1">if</span> line is not blank</span><br />
&nbsp;<span class="re3"># Remember caveats about Unix treatment of \r <span class="br0">&#40;</span>mentioned above<span class="br0">&#41;</span></span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;NF{$0=++a &quot; :&quot; $0};{print}&#8217;</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{print (NF? ++a &quot; :&quot; :&quot;&quot;) $0}&#8217;</span></p>
<p>&nbsp;<span class="re3"># count lines <span class="br0">&#40;</span>emulates </span><span class="st0">&quot;wc -l&quot;</span><span class="br0">&#41;</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;END{print NR}&#8217;</span></p>
<p>&nbsp;<span class="re3"># print the sums of the fields of every line</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{s=0; for (i=1; i&lt; =NF; i++) s=s+$i; print s}&#8217;</span></p>
<p>&nbsp;<span class="re3"># add all fields <span class="kw1">in</span> all lines and print the sum</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{for (i=1; i&lt;=NF; i++) s=s+$i}; END{print s}&#8217;</span></p>
<p>&nbsp;<span class="re3"># print every line after replacing each field with its absolute value</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{for (i=1; i&lt;=NF; i++) if ($i &lt; 0) $i = -$i; print }&#8217;</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{for (i=1; i&lt;=NF; i++) $i = ($i &lt; 0) ? -$i : $i; print }&#8217;</span></p>
<p>&nbsp;<span class="re3"># print the total number of fields <span class="br0">&#40;</span></span><span class="st0">&quot;words&quot;</span><span class="br0">&#41;</span> <span class="kw1">in</span> all lines<br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{ total = total + NF }; END {print total}&#8217;</span> <span class="kw2">file</span></p>
<p>&nbsp;<span class="re3"># print the total number of lines that contain </span><span class="st0">&quot;Beth&quot;</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;/Beth/{n++}; END {print n+0}&#8217;</span> <span class="kw2">file</span></p>
<p>&nbsp;<span class="re3"># print the largest first field and the line that contains it</span><br />
&nbsp;<span class="re3"># Intended <span class="kw1">for</span> finding the longest string <span class="kw1">in</span> field #<span class="nu0">1</span></span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;$1 &gt; max {max=$1; maxline=$0}; END{ print max, maxline}&#8217;</span></p>
<p>&nbsp;<span class="re3"># print the number of fields <span class="kw1">in</span> each line, followed by the line</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{ print NF &quot;:&quot; $0 } &#8216;</span></p>
<p>&nbsp;<span class="re3"># print the <span class="kw2">last</span> field of each line</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{ print $NF }&#8217;</span></p>
<p>&nbsp;<span class="re3"># print the <span class="kw2">last</span> field of the <span class="kw2">last</span> line</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{ field = $NF }; END{ print field }&#8217;</span></p>
<p>&nbsp;<span class="re3"># print every line with <span class="kw2">more</span> than <span class="nu0">4</span> fields</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;NF &gt; 4&#8242;</span></p>
<p>&nbsp;<span class="re3"># print every line where the value of the <span class="kw2">last</span> field is &gt; <span class="nu0">4</span></span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;$NF &gt; 4&#8242;</span></p>
<p>
TEXT CONVERSION AND SUBSTITUTION:</p>
<p>&nbsp;<span class="re3"># IN UNIX ENVIRONMENT: convert DOS newlines <span class="br0">&#40;</span>CR/LF<span class="br0">&#41;</span> to Unix format</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{sub(/<span class="es0">\r</span>$/,&quot;&quot;);print}&#8217;</span> &nbsp; <span class="re3"># assumes EACH line ends with Ctrl-M</span></p>
<p>&nbsp;<span class="re3"># IN UNIX ENVIRONMENT: convert Unix newlines <span class="br0">&#40;</span>LF<span class="br0">&#41;</span> to DOS format</span><br />
&nbsp;<span class="kw2">awk</span> <span class="st0">&#8216;{sub(/$/,&quot;<span class="es0">\r</span>&quot;);print}</p>
<p>&nbsp;# IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format<br />
&nbsp;awk 1</p>
<p>&nbsp;# IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format<br />
&nbsp;# Cannot be done with DOS versions of awk, other than gawk:<br />
&nbsp;gawk -v BINMODE=&quot;w&quot; &#8216;</span><span class="nu0">1</span><span class="st0">&#8216; infile &gt;outfile</p>
<p>&nbsp;# Use &quot;tr&quot; instead.<br />
&nbsp;tr -d <span class="es0">\r</span> &lt;infile&gt;outfile &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# GNU tr version 1.22 or higher</p>
<p>&nbsp;# delete leading whitespace (spaces, tabs) from front of each line<br />
&nbsp;# aligns all text flush left<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>sub<span class="br0">&#40;</span>/^<span class="br0">&#91;</span> \t<span class="br0">&#93;</span>+/, <span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>; print<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# delete trailing whitespace (spaces, tabs) from end of each line<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>sub<span class="br0">&#40;</span>/<span class="br0">&#91;</span> \t<span class="br0">&#93;</span>+$/, <span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;print<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# delete BOTH leading and trailing whitespace from each line<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>gsub<span class="br0">&#40;</span>/^<span class="br0">&#91;</span> \t<span class="br0">&#93;</span>+|<span class="br0">&#91;</span> \t<span class="br0">&#93;</span>+$/,<span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;print<span class="br0">&#125;</span><span class="st0">&#8216;<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>$<span class="nu0">1</span>=$<span class="nu0">1</span>;print<span class="br0">&#125;</span><span class="st0">&#8216; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # also removes extra space between fields</p>
<p>&nbsp;# insert 5 blank spaces at beginning of each line (make page offset)<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>sub<span class="br0">&#40;</span>/^/, <span class="st0">&quot; &nbsp; &nbsp; &quot;</span><span class="br0">&#41;</span>;print<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# align all text flush right on a 79-column width<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span><span class="kw3">printf</span> <span class="st0">&quot;%79s<span class="es0">\n</span>&quot;</span>, $<span class="nu0">0</span><span class="br0">&#125;</span><span class="st0">&#8216; file*</p>
<p>&nbsp;# center all text on a 79-character width<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span><span class="re2">l=</span>length<span class="br0">&#40;</span><span class="br0">&#41;</span>;<span class="re2">s=</span>int<span class="br0">&#40;</span><span class="br0">&#40;</span><span class="nu0">79</span>-l<span class="br0">&#41;</span>/<span class="nu0">2</span><span class="br0">&#41;</span>; <span class="kw3">printf</span> <span class="st0">&quot;%&quot;</span><span class="br0">&#40;</span>s+l<span class="br0">&#41;</span><span class="st0">&quot;s<span class="es0">\n</span>&quot;</span>,$<span class="nu0">0</span><span class="br0">&#125;</span><span class="st0">&#8216; file*</p>
<p>&nbsp;# substitute (find and replace) &quot;foo&quot; with &quot;bar&quot; on each line<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>sub<span class="br0">&#40;</span>/foo/,<span class="st0">&quot;bar&quot;</span><span class="br0">&#41;</span>;print<span class="br0">&#125;</span><span class="st0">&#8216; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # replaces only 1st instance<br />
&nbsp;gawk &#8216;</span><span class="br0">&#123;</span>$<span class="nu0">0</span>=gensub<span class="br0">&#40;</span>/foo/,<span class="st0">&quot;bar&quot;</span>,<span class="nu0">4</span><span class="br0">&#41;</span>;print<span class="br0">&#125;</span><span class="st0">&#8216; &nbsp;# replaces only 4th instance<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>gsub<span class="br0">&#40;</span>/foo/,<span class="st0">&quot;bar&quot;</span><span class="br0">&#41;</span>;print<span class="br0">&#125;</span><span class="st0">&#8216; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# replaces ALL instances in a line</p>
<p>&nbsp;# substitute &quot;foo&quot; with &quot;bar&quot; ONLY for lines which contain &quot;baz&quot;<br />
&nbsp;awk &#8216;</span>/baz/<span class="br0">&#123;</span>gsub<span class="br0">&#40;</span>/foo/, <span class="st0">&quot;bar&quot;</span><span class="br0">&#41;</span><span class="br0">&#125;</span>;<span class="br0">&#123;</span>print<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# substitute &quot;foo&quot; with &quot;bar&quot; EXCEPT for lines which contain &quot;baz&quot;<br />
&nbsp;awk &#8216;</span>!/baz/<span class="br0">&#123;</span>gsub<span class="br0">&#40;</span>/foo/, <span class="st0">&quot;bar&quot;</span><span class="br0">&#41;</span><span class="br0">&#125;</span>;<span class="br0">&#123;</span>print<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# change &quot;scarlet&quot; or &quot;ruby&quot; or &quot;puce&quot; to &quot;red&quot;<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>gsub<span class="br0">&#40;</span>/scarlet|ruby|puce/, <span class="st0">&quot;red&quot;</span><span class="br0">&#41;</span>; print<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# reverse order of lines (emulates &quot;tac&quot;)<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>a<span class="br0">&#91;</span>i++<span class="br0">&#93;</span>=$<span class="nu0">0</span><span class="br0">&#125;</span> END <span class="br0">&#123;</span><span class="kw1">for</span> <span class="br0">&#40;</span><span class="re2">j=</span>i<span class="nu0">-1</span>; j&gt;=<span class="nu0">0</span>;<span class="br0">&#41;</span> print a<span class="br0">&#91;</span>j&#8211;<span class="br0">&#93;</span> <span class="br0">&#125;</span><span class="st0">&#8216; file*</p>
<p>&nbsp;# if a line ends with a backslash, append the next line to it<br />
&nbsp;# (fails if there are multiple lines ending with backslash&#8230;)<br />
&nbsp;awk &#8216;</span>/\\$/ <span class="br0">&#123;</span>sub<span class="br0">&#40;</span>/\\$/,<span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>; getline t; print $<span class="nu0">0</span> t; next<span class="br0">&#125;</span>; <span class="nu0">1</span><span class="st0">&#8216; file*</p>
<p>&nbsp;# print and sort the login names of all users<br />
&nbsp;awk -F &quot;:&quot; &#8216;</span><span class="br0">&#123;</span> print $<span class="nu0">1</span> | <span class="st0">&quot;sort&quot;</span> <span class="br0">&#125;</span><span class="st0">&#8216; /etc/passwd</p>
<p>&nbsp;# print the first 2 fields, in opposite order, of every line<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>print $<span class="nu0">2</span>, $<span class="nu0">1</span><span class="br0">&#125;</span><span class="st0">&#8216; file</p>
<p>&nbsp;# switch the first 2 fields of every line<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span>temp = $<span class="nu0">1</span>; $<span class="nu0">1</span> = $<span class="nu0">2</span>; $<span class="nu0">2</span> = temp<span class="br0">&#125;</span><span class="st0">&#8216; file</p>
<p>&nbsp;# print every line, deleting the second field of that line<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span> $<span class="nu0">2</span> = <span class="st0">&quot;&quot;</span>; print <span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# print in reverse order the fields of every line<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span><span class="kw1">for</span> <span class="br0">&#40;</span><span class="re2">i=</span>NF; i&gt;<span class="nu0">0</span>; i&#8211;<span class="br0">&#41;</span> <span class="kw3">printf</span><span class="br0">&#40;</span><span class="st0">&quot;%s &quot;</span>,i<span class="br0">&#41;</span>;printf <span class="br0">&#40;</span><span class="st0">&quot;<span class="es0">\n</span>&quot;</span><span class="br0">&#41;</span><span class="br0">&#125;</span><span class="st0">&#8216; file</p>
<p>&nbsp;# remove duplicate, consecutive lines (emulates &quot;uniq&quot;)<br />
&nbsp;awk &#8216;</span>a !~ $<span class="nu0">0</span>; <span class="br0">&#123;</span><span class="re2">a=</span>$<span class="nu0">0</span><span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# remove duplicate, nonconsecutive lines<br />
&nbsp;awk &#8216;</span>! a<span class="br0">&#91;</span>$<span class="nu0">0</span><span class="br0">&#93;</span>++<span class="st0">&#8216; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # most concise script<br />
&nbsp;awk &#8216;</span>!<span class="br0">&#40;</span>$<span class="nu0">0</span> <span class="kw1">in</span> a<span class="br0">&#41;</span> <span class="br0">&#123;</span>a<span class="br0">&#91;</span>$<span class="nu0">0</span><span class="br0">&#93;</span>;print<span class="br0">&#125;</span><span class="st0">&#8216; &nbsp; &nbsp; &nbsp;# most efficient script</p>
<p>&nbsp;# concatenate every 5 lines of input, using a comma separator<br />
&nbsp;# between fields<br />
&nbsp;awk &#8216;</span><span class="re2">ORS=</span>%NR%<span class="nu0">5</span>?<span class="st0">&quot;,&quot;</span>:<span class="st0">&quot;<span class="es0">\n</span>&quot;</span><span class="st0">&#8216; file</p>
<p>SELECTIVE PRINTING OF CERTAIN LINES:</p>
<p>&nbsp;# print first 10 lines of file (emulates behavior of &quot;head&quot;)<br />
&nbsp;awk &#8216;</span>NR &lt; <span class="nu0">11</span><span class="st0">&#8216;</p>
<p>&nbsp;# print first line of file (emulates &quot;head -1&quot;)<br />
&nbsp;awk &#8216;</span>NR&gt;<span class="nu0">1</span><span class="br0">&#123;</span><span class="kw3">exit</span><span class="br0">&#125;</span>;<span class="nu0">1</span><span class="st0">&#8216;</p>
<p>&nbsp; # print the last 2 lines of a file (emulates &quot;tail -2&quot;)<br />
&nbsp;awk &#8216;</span><span class="br0">&#123;</span><span class="re2">y=</span>x <span class="st0">&quot;<span class="es0">\n</span>&quot;</span> $<span class="nu0">0</span>; <span class="re2">x=</span>$<span class="nu0">0</span><span class="br0">&#125;</span>;END<span class="br0">&#123;</span>print y<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# print the last line of a file (emulates &quot;tail -1&quot;)<br />
&nbsp;awk &#8216;</span>END<span class="br0">&#123;</span>print<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# print only lines which match regular expression (emulates &quot;grep&quot;)<br />
&nbsp;awk &#8216;</span>/regex/<span class="st0">&#8216;</p>
<p>&nbsp;# print only lines which do NOT match regex (emulates &quot;grep -v&quot;)<br />
&nbsp;awk &#8216;</span>!/regex/<span class="st0">&#8216;</p>
<p>&nbsp;# print the line immediately before a regex, but not the line<br />
&nbsp;# containing the regex<br />
&nbsp;awk &#8216;</span>/regex/<span class="br0">&#123;</span>print x<span class="br0">&#125;</span>;<span class="br0">&#123;</span><span class="re2">x=</span>$<span class="nu0">0</span><span class="br0">&#125;</span><span class="st0">&#8216;<br />
&nbsp;awk &#8216;</span>/regex/<span class="br0">&#123;</span>print <span class="br0">&#40;</span><span class="re2">x=</span>=<span class="st0">&quot;&quot;</span> ? <span class="st0">&quot;match on line 1&quot;</span> : x<span class="br0">&#41;</span><span class="br0">&#125;</span>;<span class="br0">&#123;</span><span class="re2">x=</span>$<span class="nu0">0</span><span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# print the line immediately after a regex, but not the line<br />
&nbsp;# containing the regex<br />
&nbsp;awk &#8216;</span>/regex/<span class="br0">&#123;</span>getline;print<span class="br0">&#125;</span><span class="st0">&#8216;</p>
<p>&nbsp;# grep for AAA and BBB and CCC (in any order)<br />
&nbsp;awk &#8216;</span>/AAA/; /BBB/; /CCC/<span class="st0">&#8216;</p>
<p>&nbsp;# grep for AAA and BBB and CCC (in that order)<br />
&nbsp;awk &#8216;</span>/AAA.*BBB.*CCC/<span class="st0">&#8216;</p>
<p>&nbsp;# print only lines of 65 characters or longer<br />
&nbsp;awk &#8216;</span>length &gt; <span class="nu0">64</span><span class="st0">&#8216;</p>
<p>&nbsp;# print only lines of less than 65 characters<br />
&nbsp;awk &#8216;</span>length &lt; <span class="nu0">64</span><span class="st0">&#8216;</p>
<p>&nbsp;# print section of file from regular expression to end of file<br />
&nbsp;awk &#8216;</span>/regex/,<span class="nu0">0</span><span class="st0">&#8216;<br />
&nbsp;awk &#8216;</span>/regex/,EOF<span class="st0">&#8216;</p>
<p>&nbsp;# print section of file based on line numbers (lines 8-12, inclusive)<br />
&nbsp;awk &#8216;</span><span class="re2">NR=</span>=<span class="nu0">8</span>,<span class="re2">NR=</span>=<span class="nu0">12</span><span class="st0">&#8216;</p>
<p>&nbsp;# print line number 52<br />
&nbsp;awk &#8216;</span><span class="re2">NR=</span>=<span class="nu0">52</span><span class="st0">&#8216;<br />
&nbsp;awk &#8216;</span><span class="re2">NR=</span>=<span class="nu0">52</span> <span class="br0">&#123;</span>print;exit<span class="br0">&#125;</span><span class="st0">&#8216; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# more efficient on large files</p>
<p>&nbsp;# print section of file between two regular expressions (inclusive)<br />
&nbsp;awk &#8216;</span>/Iowa/,/Montana/<span class="st0">&#8216; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # case sensitive</p>
<p>
SELECTIVE DELETION OF CERTAIN LINES:</p>
<p>&nbsp;# delete ALL blank lines from a file (same as &quot;grep &#8216;</span>.<span class="st0">&#8216; &quot;)<br />
&nbsp;awk NF<br />
&nbsp;awk &#8216;</span>/./<span class="st0">&#8216;</p>
<p></span></div>
<p>CREDITS AND THANKS:</p>
<p>Special thanks to Peter S. Tillier for helping me with the first release<br />
of this FAQ file.</p>
<p>For additional syntax instructions, including the way to apply editing<br />
commands from a disk file instead of the command line, consult:</p>
<p>&#8220;sed &#038; awk, 2nd Edition,&#8221; by Dale Dougherty and Arnold Robbins<br />
  O&#8217;Reilly, 1997<br />
&#8220;UNIX Text Processing,&#8221; by Dale Dougherty and Tim O&#8217;Reilly<br />
  Hayden Books, 1987<br />
&#8220;Effective awk Programming, 3rd Edition.&#8221; by Arnold Robbins<br />
  O&#8217;Reilly, 2001</p>
<p>To fully exploit the power of awk, one must understand &#8220;regular<br />
expressions.&#8221; For detailed discussion of regular expressions, see<br />
&#8220;Mastering Regular Expressions, 2d edition&#8221; by Jeffrey Friedl<br />
   (O&#8217;Reilly, 2002).</p>
<p>The manual (&#8220;man&#8221;) pages on Unix systems may be helpful (try &#8220;man awk&#8221;,<br />
&#8220;man nawk&#8221;, &#8220;man regexp&#8221;, or the section on regular expressions in &#8220;man<br />
ed&#8221;), but man pages are notoriously difficult. They are not written to<br />
teach awk use or regexps to first-time users, but as a reference text<br />
for those already acquainted with these tools.</p>
<p>USE OF &#8216;\t&#8217; IN awk SCRIPTS: For clarity in documentation, we have used<br />
the expression &#8216;\t&#8217; to indicate a tab character (0&#215;09) in the scripts.<br />
All versions of awk, even the UNIX System 7 version should recognize<br />
the &#8216;\t&#8217; abbreviation.</p>
<p>#&#8212;end of file&#8212;</p>
<p></infile></pre>
</pemente>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/1891_test-in-shel.html" title="Shell中的[]">Shell中的[]</a> (10)</li><li><a href="http://www.rickyzhu.com/1830_vim.html" title="Learning Vim">Learning Vim</a> (0)</li><li><a href="http://www.rickyzhu.com/901_read-file-in-shell.html" title="Shell中读取文件">Shell中读取文件</a> (0)</li><li><a href="http://www.rickyzhu.com/890_linux-vs-solaris-dat.html" title="Linux/Solair对时间的处理">Linux/Solair对时间的处理</a> (1)</li><li><a href="http://www.rickyzhu.com/488_good-unix-habit.html" title="Unix高手的另外十个习惯">Unix高手的另外十个习惯</a> (1)</li><li><a href="http://www.rickyzhu.com/480_varable-replace-in-sed.html" title="sed中如何引用变量">sed中如何引用变量</a> (2)</li><li><a href="http://www.rickyzhu.com/467_shell-exam.html" title="Shell综合水平测试">Shell综合水平测试</a> (0)</li><li><a href="http://www.rickyzhu.com/444_cluster-console-script.html" title="Clusterware Console脚本分享">Clusterware Console脚本分享</a> (0)</li><li><a href="http://www.rickyzhu.com/441_not-use-cshell.html" title="十大原因告诉你不要使用CShell">十大原因告诉你不要使用CShell</a> (0)</li><li><a href="http://www.rickyzhu.com/415_linux-test-and-compare.html" title="Linux Bash 测试和比较函数">Linux Bash 测试和比较函数</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/2003_handy-awk.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GNU/Linux Advanced Administration</title>
		<link>http://www.rickyzhu.com/1997_gnulinux-advanced-administration.html</link>
		<comments>http://www.rickyzhu.com/1997_gnulinux-advanced-administration.html#comments</comments>
		<pubDate>Thu, 04 Feb 2010 06:31:15 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[脚本语言]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=1997</guid>
		<description><![CDATA[非常不错的一本电子书，从GNU/Linux的来历，发行版，内核，一直讲到GNU/Linux的管理（包括工具，网络管理，数据管理，服务器管理，安全管理，配置管理和优化以至于集群技术）非常的全面和细致，共享一下。
PDF下载
Related PostsLinux System and Performance Monitoring (1)Learning Vim (0)NTFS分区修复记 (0)自由软件运动和Richard Stallman大师 (4)Ubuntu的两个bug (2)Ubuntu9.10 is coming (2)Using vi (2)使用screen管理多个shell (3)10个最有用的Linux命令 (0)类似于vi的Firefox插件-vimperator (5)]]></description>
			<content:encoded><![CDATA[<p>非常不错的一本电子书，从GNU/Linux的来历，发行版，内核，一直讲到GNU/Linux的管理（包括工具，网络管理，数据管理，服务器管理，安全管理，配置管理和优化以至于集群技术）非常的全面和细致，共享一下。</p>
<p><a href="http://ftacademy.org/files/materials/fta-m2-admin_gnulinux-v1.pdf">PDF下载</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/1945_linux-system-and-performance.html" title="Linux System and Performance Monitoring">Linux System and Performance Monitoring</a> (1)</li><li><a href="http://www.rickyzhu.com/1830_vim.html" title="Learning Vim">Learning Vim</a> (0)</li><li><a href="http://www.rickyzhu.com/1820_pttd-to-resume-dis.html" title="NTFS分区修复记">NTFS分区修复记</a> (0)</li><li><a href="http://www.rickyzhu.com/1784_meet-richard-stallman.html" title="自由软件运动和Richard Stallman大师">自由软件运动和Richard Stallman大师</a> (4)</li><li><a href="http://www.rickyzhu.com/1768_ubuntu-twobug.html" title="Ubuntu的两个bug">Ubuntu的两个bug</a> (2)</li><li><a href="http://www.rickyzhu.com/1760_ubuntu910-coming.html" title="Ubuntu9.10 is coming">Ubuntu9.10 is coming</a> (2)</li><li><a href="http://www.rickyzhu.com/862_using-vi.html" title="Using vi">Using vi</a> (2)</li><li><a href="http://www.rickyzhu.com/860_screen-usage.html" title="使用screen管理多个shell">使用screen管理多个shell</a> (3)</li><li><a href="http://www.rickyzhu.com/858_ten-useful-linux-cmd.html" title="10个最有用的Linux命令">10个最有用的Linux命令</a> (0)</li><li><a href="http://www.rickyzhu.com/765_vimperator.html" title="类似于vi的Firefox插件-vimperator">类似于vi的Firefox插件-vimperator</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/1997_gnulinux-advanced-administration.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Oracle+Sun Product Line</title>
		<link>http://www.rickyzhu.com/1990_oraclesun-product-line.html</link>
		<comments>http://www.rickyzhu.com/1990_oraclesun-product-line.html#comments</comments>
		<pubDate>Tue, 02 Feb 2010 08:40:10 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[业界]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=1990</guid>
		<description><![CDATA[With SUN, oracle&#8217;s product line is complete now.

and comparison 

Just record it for reference.
Related Posts欧盟批准Oracle收购SUN (1)Oracle Database 11gR2 for HP-UX and AIX released  (3)Oracle Patchset Reference (2)11.2.0.1.0 on Solaris.Sparc64 and Solaris.X64 released (0)Metalink即将退休 (4)Oracle Database 11gR2 Clusterware之资源 (0)Oracle+Sun VS IBM (1)Oracle Database 11gR2 Clusterware之后台进程 (1)Oracle Database 11gR2 Released (1)Troubleshoot CRS 10.2.0.4 on EL5 (1) [...]]]></description>
			<content:encoded><![CDATA[<p>With SUN, oracle&#8217;s product line is complete now.</p>
<p><a href="http://www.rickyzhu.com/wp-content/oraclesunproduct.png"><img src="http://www.rickyzhu.com/wp-content/oraclesunproduct-300x208.png" alt="" title="oracle sun product" width="300" height="208" class="alignnone size-medium wp-image-1992" /></a></p>
<p>and comparison </p>
<p><a href="http://www.rickyzhu.com/wp-content/sunoracleproduct2.png"><img src="http://www.rickyzhu.com/wp-content/sunoracleproduct2-300x197.png" alt="" title="sun oracle product2" width="300" height="197" class="alignnone size-medium wp-image-1991" /></a></p>
<p>Just record it for reference.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/1975_oracle-clear-oracle-sun-deal.html" title="欧盟批准Oracle收购SUN">欧盟批准Oracle收购SUN</a> (1)</li><li><a href="http://www.rickyzhu.com/1894_11-2-for-aix-and-hpi.html" title="Oracle Database 11gR2 for HP-UX and AIX released ">Oracle Database 11gR2 for HP-UX and AIX released </a> (3)</li><li><a href="http://www.rickyzhu.com/1841_patchset-reference.html" title="Oracle Patchset Reference">Oracle Patchset Reference</a> (2)</li><li><a href="http://www.rickyzhu.com/1817_11-2-for-solairs-release.html" title="11.2.0.1.0 on Solaris.Sparc64 and Solaris.X64 released">11.2.0.1.0 on Solaris.Sparc64 and Solaris.X64 released</a> (0)</li><li><a href="http://www.rickyzhu.com/1792_metalink.html" title="Metalink即将退休">Metalink即将退休</a> (4)</li><li><a href="http://www.rickyzhu.com/915_11-2-crs-resource.html" title="Oracle Database 11gR2 Clusterware之资源">Oracle Database 11gR2 Clusterware之资源</a> (0)</li><li><a href="http://www.rickyzhu.com/908_oraclesun-vs-ibm.html" title="Oracle+Sun VS IBM">Oracle+Sun VS IBM</a> (1)</li><li><a href="http://www.rickyzhu.com/898_11-2-crsprocesses.html" title="Oracle Database 11gR2 Clusterware之后台进程">Oracle Database 11gR2 Clusterware之后台进程</a> (1)</li><li><a href="http://www.rickyzhu.com/895_oracle-database-11gr2-released.html" title="Oracle Database 11gR2 Released">Oracle Database 11gR2 Released</a> (1)</li><li><a href="http://www.rickyzhu.com/882_troubleshoot-crs-10204-1.html" title="Troubleshoot CRS 10.2.0.4 on EL5 (1)">Troubleshoot CRS 10.2.0.4 on EL5 (1)</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/1990_oraclesun-product-line.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>入口腾龙17-50</title>
		<link>http://www.rickyzhu.com/1985_get-tamron-b00.html</link>
		<comments>http://www.rickyzhu.com/1985_get-tamron-b00.html#comments</comments>
		<pubDate>Sat, 30 Jan 2010 12:22:38 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[生活点滴]]></category>
		<category><![CDATA[Photograph]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=1985</guid>
		<description><![CDATA[纠结了N久了，今天终于3550元搞定了腾龙17-50，也就是传说中的B005。（A16的升级版本）这款比A16增加了防抖功能，并把口径从67mm增加到了72mm，其实最值得期待的还是他的2.8的恒定大光圈。
在副厂镜头中，这绝对是一款佼佼者，性价比较高。要知道，Canon原厂的17-40 4L的报价一直都在5000元以上，这款恒定2.8行货价格才3000多，而且蜂鸟上的评测和口碑也一直都不错。
刚刚上腾龙网站发现这款镜头获得2010年日本数码相机大奖的金奖

具体指标：
型号 	B005
焦距 	17-50mm
光圈 	F/2.8
视角 	78° 45’～31° 11’
镜片构成 	14组19片
最近摄距 	0.29m
最大摄影倍率 	1：4.8
工作距离 	72mm
总长 	94.5mm*
最大直径 	79.6mm
重量 	570g*
光圈叶片数 	7片
最小光圈 	F/32
标准附件 	花瓣型遮光罩
［更新］
效果图一

效果图二

更多效果图 （请酌情翻墙）
update
出手手里的这款佳能450D 套机头 18－55mm is 
Related Posts2009深港澳车展 (3)入手5018 (15)入手Canon 450D (7)打算入手450D (14)]]></description>
			<content:encoded><![CDATA[<p>纠结了N久了，今天终于3550元搞定了腾龙17-50，也就是传说中的B005。（A16的升级版本）这款比A16增加了防抖功能，并把口径从67mm增加到了72mm，其实最值得期待的还是他的2.8的恒定大光圈。<br />
在副厂镜头中，这绝对是一款佼佼者，性价比较高。要知道，Canon原厂的17-40 4L的报价一直都在5000元以上，这款恒定2.8行货价格才3000多，而且<a href="http://review.fengniao.com/151/1517509.html">蜂鸟上的评测</a>和口碑也一直都不错。<br />
刚刚上腾龙网站发现这款镜头获得2010<a href="http://www.tamron.com.cn/show.asp?i=159">年日本数码相机大奖的金奖</a></p>
<p><img src="http://www.tamron.com.cn/admin/Upjpeg/200910231408190.jpg" alt="B005" /></p>
<p>具体指标：</p>
<p>型号 	B005<br />
焦距 	17-50mm<br />
光圈 	F/2.8<br />
视角 	78° 45’～31° 11’<br />
镜片构成 	14组19片<br />
最近摄距 	0.29m<br />
最大摄影倍率 	1：4.8<br />
工作距离 	72mm<br />
总长 	94.5mm*<br />
最大直径 	79.6mm<br />
重量 	570g*<br />
光圈叶片数 	7片<br />
最小光圈 	F/32<br />
标准附件 	花瓣型遮光罩</p>
<p>［更新］<br />
效果图一<br />
<img src="http://lh6.ggpht.com/_cNGN-_SRzpU/S2Ypdf8OjRI/AAAAAAAAAzQ/fd_bLVIT360/s800/IMG_6870.JPG" alt="B005-1" /><br />
效果图二<br />
<img src="http://lh6.ggpht.com/_cNGN-_SRzpU/S2YqIESbkCI/AAAAAAAAA2g/IK-EjjVQot4/s800/IMG_6948.JPG" alt="B005-2" /></p>
<p><a href="http://picasaweb.google.com/Billzhu0519/B005#">更多效果图</a> （请酌情翻墙）</p>
<p>update<br />
出手手里的这款<a href="http://item.taobao.com/auction/item_detail-0db1-48a9f6d5f8f794ee21c63af7800b9411.jhtml">佳能450D 套机头 18－55mm is </a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/845_2009-shenzhen-auto.html" title="2009深港澳车展">2009深港澳车展</a> (3)</li><li><a href="http://www.rickyzhu.com/525_%e5%85%a5%e6%89%8b5018.html" title="入手5018">入手5018</a> (15)</li><li><a href="http://www.rickyzhu.com/489_buy-dslr-in-hk.html" title="入手Canon 450D">入手Canon 450D</a> (7)</li><li><a href="http://www.rickyzhu.com/487_plan-to-buy-450d.html" title="打算入手450D">打算入手450D</a> (14)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/1985_get-tamron-b00.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>用户界面测试的颠覆性技术-Sikuli</title>
		<link>http://www.rickyzhu.com/1979_sikuli.html</link>
		<comments>http://www.rickyzhu.com/1979_sikuli.html#comments</comments>
		<pubDate>Wed, 27 Jan 2010 14:59:35 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[测试工具]]></category>
		<category><![CDATA[测试自动化]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=1979</guid>
		<description><![CDATA[Sikuli绝对是一种颠覆性的技术，至少对于GUI的测试技术来说，是质的突破，比如它彻底解决了在这之前GUI自动化测试工具上的关键点-对象识别。
技术来自于从麻省理工学院计算机和艺术智能实验室的一个用户界面设计小组的研究项目，Sikuli脚本和Sikuli开发平台基于MIT License发布，是开源的。
什么是Sikuli
========
Sikuli是一种利用图片（快照）去搜索和自动化GUI的视觉技术，Sikuli的第一个release包含Sikuli脚本，也就是为Jython编写的一种视觉脚本API，同时包含了Sikuli IDE，一个可以非常容易的用快照书写视觉脚本的集成开发环境。Sikuli脚本可以自动化你在屏幕上看到的一切，而这不需要内部API的支持。你可以编程控制一个页面，一个运行在Windows/Linux/Mac OS X上的桌面应用程序，甚至于一个运行在模拟终端的iphone的应用程序。
Sikuli的必杀技
========
自动化所有你看到的一切
利用快照进行自动化
工作在Java平台（意味着可移植）
Sikuli安装和使用
===========
下载安装了一下，在Windows上需要JDK1.6以上环境，这里有一个简单的视频介绍（看不到youtube的同学翻墙吧）。
不会翻墙的地同学请从如下视频观看：

继续阅读论文
=========
GUI Testing Using Computer Vision
Sikuli: Using GUI Screenshots for Search and Automation
MIT news介绍图像驱动计算
一个例子快照
=========

拭目以待！
Related PostsThree Key Tools for Test Automation (3)自动化测试和性能分析文章汇总 (1)自动化测试不是银弹 (0)自动化测试的计划和实施第四阶段 (0)自动化测试的计划和实施第三阶段 (0)自动化测试的计划和实施第二阶段 (3)]]></description>
			<content:encoded><![CDATA[<p><a href="http://sikuli.org">Sikuli</a>绝对是一种颠覆性的技术，至少对于GUI的测试技术来说，是质的突破，比如它彻底解决了在这之前GUI自动化测试工具上的关键点-对象识别。</p>
<p>技术来自于从<a href="http://www.csail.mit.edu/">麻省理工学院计算机和艺术智能实验室</a>的一个<a href="http://groups.csail.mit.edu/uid/">用户界面设计小组</a>的研究项目，Sikuli脚本和Sikuli开发平台基于<a href="http://opensource.org/licenses/mit-license.php">MIT License</a>发布，是开源的。</p>
<p>什么是Sikuli<br />
========<br />
Sikuli是一种利用图片（快照）去搜索和自动化GUI的视觉技术，Sikuli的第一个release包含Sikuli脚本，也就是为<a href="http://www.jython.org/">Jython</a>编写的一种视觉脚本API，同时包含了Sikuli IDE，一个可以非常容易的用快照书写视觉脚本的集成开发环境。Sikuli脚本可以自动化你在屏幕上看到的一切，而这不需要内部API的支持。你可以编程控制一个页面，一个运行在Windows/Linux/Mac OS X上的桌面应用程序，甚至于一个运行在模拟终端的iphone的应用程序。</p>
<p>Sikuli的必杀技<br />
========<br />
自动化所有你看到的一切<br />
利用快照进行自动化<br />
工作在Java平台（意味着可移植）</p>
<p>Sikuli安装和使用<br />
===========<br />
下载安装了一下，在Windows上需要JDK1.6以上环境，<a href="http://www.youtube.com/v/FxDOlhysFcM&#038;fs=1&#038;rel=0&#038;hd=1&#038;iframe=true&#038;width=640&#038;height=505">这里</a>有一个简单的视频介绍（看不到youtube的同学翻墙吧）。</p>
<p>不会翻墙的地同学请从如下视频观看：<br />
<embed src="http://player.youku.com/player.php/sid/XMTQ4Njc4OTcy/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed></p>
<p>继续阅读论文<br />
=========<br />
<a href="http://groups.csail.mit.edu/uid/projects/sikuli/sikuli-chi2010.pdf">GUI Testing Using Computer Vision</a></p>
<p><a href="http://groups.csail.mit.edu/uid/projects/sikuli/sikuli-uist2009.pdf">Sikuli: Using GUI Screenshots for Search and Automation</a></p>
<p>MIT news<a href="http://web.mit.edu/newsoffice/2010/screen-shots-0120.html">介绍图像驱动计算</a></p>
<p>一个例子快照<br />
=========<br />
<img src="http://groups.csail.mit.edu/uid/sikuli/images/facebook.png" alt="sikuli" /></p>
<p>拭目以待！</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/817_three-key-tools-for-test-automation.html" title="Three Key Tools for Test Automation">Three Key Tools for Test Automation</a> (3)</li><li><a href="http://www.rickyzhu.com/395_testing-post-summary.html" title="自动化测试和性能分析文章汇总">自动化测试和性能分析文章汇总</a> (1)</li><li><a href="http://www.rickyzhu.com/286_there-is-no-silver-bullet.html" title="自动化测试不是银弹">自动化测试不是银弹</a> (0)</li><li><a href="http://www.rickyzhu.com/190_test-automation-implement-last-step.html" title="自动化测试的计划和实施第四阶段">自动化测试的计划和实施第四阶段</a> (0)</li><li><a href="http://www.rickyzhu.com/171_test-automation-implement-third-step.html" title="自动化测试的计划和实施第三阶段">自动化测试的计划和实施第三阶段</a> (0)</li><li><a href="http://www.rickyzhu.com/165_test-automation-implement-second-step.html" title="自动化测试的计划和实施第二阶段">自动化测试的计划和实施第二阶段</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/1979_sikuli.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>欧盟批准Oracle收购SUN</title>
		<link>http://www.rickyzhu.com/1975_oracle-clear-oracle-sun-deal.html</link>
		<comments>http://www.rickyzhu.com/1975_oracle-clear-oracle-sun-deal.html#comments</comments>
		<pubDate>Fri, 22 Jan 2010 01:48:35 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[业界]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=1975</guid>
		<description><![CDATA[经过长达半年的谈判，欧盟终于批准了这笔74亿美金的交易，Oracle成功收购SUN，对于Oracle这将是一个标准性的事件。
EU Clears Oracle to Buy Sun Microsystems

毫无疑问，这是一家伟大的公司，是一个英雄辈出的公司，不过看到这个长长的列表，我还是有点震撼
【在Sun公司工作的杰出科学家和工程师】 
Bill Joy（BSD和vi之父）
Ivan Sutherland（图灵奖得主）
Bryan Cantrill（DTrace之父）
Steve Bourne（Bourne shell之父）
Jeff Bonwick（ZFS之父）
Joshua Bloch（Java教父）
Guy L. Steele, Jr.（Scheme之父）
James Duncan Davidson（Tomcat之父）
Whitfield Diffie（公钥算法之父）
Craig McClanahan（Struts之父）
Ian Murdock（Debian之父）
Jakob Nielsen（可用性权威）
Radia Perlman（Internet之母）
Marc Tremblay（UltraSPARC处理器）
Marc Fleury（JBoss之父）
Tim Bray（XML）
Peter Norvig（Google研发总监）
John Ousterhout（Tcl之父） 
【在Sun公司工作过的杰出企业家】 
Eric Schmidt（Google，lex）
Andy Bechtolsheim（Sun创始人，Google的第一个投资者）
庄思浩（BEA） =>没想到BEA，SUN最后都被Oracle收购了&#8230;
Chris Malachowsky（NVIDIA） 

Related PostsOracle+Sun Product Line (3)Oracle Database 11gR2 for HP-UX and AIX released  (3)Oracle Patchset Reference (2)11.2.0.1.0 on Solaris.Sparc64 [...]]]></description>
			<content:encoded><![CDATA[<p>经过长达半年的谈判，欧盟终于批准了这笔74亿美金的交易，Oracle成功收购SUN，对于Oracle这将是一个标准性的事件。</p>
<p><a href="http://online.wsj.com/article/SB10001424052748703699204575016561637563060.html">EU Clears Oracle to Buy Sun Microsystems</a></p>
<p><ins datetime="2010-01-25T04:58:32+00:00"></p>
<p>毫无疑问，这是一家伟大的公司，是一个英雄辈出的公司，不过看到这个长长的列表，我还是有点震撼</p>
<p>【在Sun公司工作的杰出科学家和工程师】 </p>
<p>Bill Joy（<a href="http://www.bsd.org/">BSD</a>和<a href="http://www.vim.org/">vi</a>之父）<br />
Ivan Sutherland（图灵奖得主）<br />
Bryan Cantrill（<a href="http://www.sun.com/bigadmin/content/dtrace/">DTrace</a>之父）<br />
Steve Bourne（<a href="http://en.wikipedia.org/wiki/Bourne_shell">Bourne shell</a>之父）<br />
Jeff Bonwick（<a href="http://wiki.freebsd.org/ZFS">ZFS</a>之父）<br />
Joshua Bloch（<a href="http://www.java.com/">Java</a>教父）<br />
Guy L. Steele, Jr.（<a href="http://en.wikipedia.org/wiki/Scheme_(programming_language)">Scheme</a>之父）<br />
James Duncan Davidson（<a href="http://tomcat.apache.org/">Tomcat</a>之父）<br />
Whitfield Diffie（公钥算法之父）<br />
Craig McClanahan（<a href="http://struts.apache.org/">Struts</a>之父）<br />
Ian Murdock（<a href="http://www.debian.org/">Debian</a>之父）<br />
Jakob Nielsen（可用性权威）<br />
Radia Perlman（Internet之母）<br />
Marc Tremblay（<a href="http://www.sun.com/processors/UltraSPARC-T2/">UltraSPARC</a>处理器）<br />
Marc Fleury（<a href="http://www.jboss.com/">JBoss</a>之父）<br />
Tim Bray（<a href="http://en.wikipedia.org/wiki/XML">XML</a>）<br />
Peter Norvig（Google研发总监）<br />
John Ousterhout（<a href="http://en.wikipedia.org/wiki/Tcl">Tcl</a>之父） </p>
<p>【在Sun公司工作过的杰出企业家】 </p>
<p>Eric Schmidt（Google，lex）<br />
Andy Bechtolsheim（Sun创始人，Google的第一个投资者）<br />
庄思浩（BEA） =>没想到BEA，SUN最后都被Oracle收购了&#8230;<br />
Chris Malachowsky（NVIDIA） </p>
<p></ins></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/1990_oraclesun-product-line.html" title="Oracle+Sun Product Line">Oracle+Sun Product Line</a> (3)</li><li><a href="http://www.rickyzhu.com/1894_11-2-for-aix-and-hpi.html" title="Oracle Database 11gR2 for HP-UX and AIX released ">Oracle Database 11gR2 for HP-UX and AIX released </a> (3)</li><li><a href="http://www.rickyzhu.com/1841_patchset-reference.html" title="Oracle Patchset Reference">Oracle Patchset Reference</a> (2)</li><li><a href="http://www.rickyzhu.com/1817_11-2-for-solairs-release.html" title="11.2.0.1.0 on Solaris.Sparc64 and Solaris.X64 released">11.2.0.1.0 on Solaris.Sparc64 and Solaris.X64 released</a> (0)</li><li><a href="http://www.rickyzhu.com/1792_metalink.html" title="Metalink即将退休">Metalink即将退休</a> (4)</li><li><a href="http://www.rickyzhu.com/915_11-2-crs-resource.html" title="Oracle Database 11gR2 Clusterware之资源">Oracle Database 11gR2 Clusterware之资源</a> (0)</li><li><a href="http://www.rickyzhu.com/908_oraclesun-vs-ibm.html" title="Oracle+Sun VS IBM">Oracle+Sun VS IBM</a> (1)</li><li><a href="http://www.rickyzhu.com/898_11-2-crsprocesses.html" title="Oracle Database 11gR2 Clusterware之后台进程">Oracle Database 11gR2 Clusterware之后台进程</a> (1)</li><li><a href="http://www.rickyzhu.com/895_oracle-database-11gr2-released.html" title="Oracle Database 11gR2 Released">Oracle Database 11gR2 Released</a> (1)</li><li><a href="http://www.rickyzhu.com/882_troubleshoot-crs-10204-1.html" title="Troubleshoot CRS 10.2.0.4 on EL5 (1)">Troubleshoot CRS 10.2.0.4 on EL5 (1)</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/1975_oracle-clear-oracle-sun-deal.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux System and Performance Monitoring</title>
		<link>http://www.rickyzhu.com/1945_linux-system-and-performance.html</link>
		<comments>http://www.rickyzhu.com/1945_linux-system-and-performance.html#comments</comments>
		<pubDate>Fri, 15 Jan 2010 04:37:39 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[主机]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=1945</guid>
		<description><![CDATA[新年第一篇
转载sanotes的这篇非常实用的Linux System and Performance Monitoring 翻译文档，包括CPU篇，内存篇，IO篇，网络篇，总结篇等五个部分，整理成了pdf方便下载。
Linux system and performance monitoring PDF下载
原文
Related PostsGNU/Linux Advanced Administration (2)Learning Vim (0)NTFS分区修复记 (0)自由软件运动和Richard Stallman大师 (4)Ubuntu的两个bug (2)Ubuntu9.10 is coming (2)Using vi (2)使用screen管理多个shell (3)10个最有用的Linux命令 (0)类似于vi的Firefox插件-vimperator (5)]]></description>
			<content:encoded><![CDATA[<p>新年第一篇</p>
<p>转载<a href="http://www.sanotes.net">sanotes</a>的这篇非常实用的Linux System and Performance Monitoring 翻译文档，包括CPU篇，内存篇，IO篇，网络篇，总结篇等五个部分，整理成了pdf方便下载。</p>
<p><a href='http://www.rickyzhu.com/wp-content/LSPM.pdf'>Linux system and performance monitoring PDF下载</a><br />
<a href="http://www.sanotes.net/html/y2009/370.html">原文</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/1997_gnulinux-advanced-administration.html" title="GNU/Linux Advanced Administration">GNU/Linux Advanced Administration</a> (2)</li><li><a href="http://www.rickyzhu.com/1830_vim.html" title="Learning Vim">Learning Vim</a> (0)</li><li><a href="http://www.rickyzhu.com/1820_pttd-to-resume-dis.html" title="NTFS分区修复记">NTFS分区修复记</a> (0)</li><li><a href="http://www.rickyzhu.com/1784_meet-richard-stallman.html" title="自由软件运动和Richard Stallman大师">自由软件运动和Richard Stallman大师</a> (4)</li><li><a href="http://www.rickyzhu.com/1768_ubuntu-twobug.html" title="Ubuntu的两个bug">Ubuntu的两个bug</a> (2)</li><li><a href="http://www.rickyzhu.com/1760_ubuntu910-coming.html" title="Ubuntu9.10 is coming">Ubuntu9.10 is coming</a> (2)</li><li><a href="http://www.rickyzhu.com/862_using-vi.html" title="Using vi">Using vi</a> (2)</li><li><a href="http://www.rickyzhu.com/860_screen-usage.html" title="使用screen管理多个shell">使用screen管理多个shell</a> (3)</li><li><a href="http://www.rickyzhu.com/858_ten-useful-linux-cmd.html" title="10个最有用的Linux命令">10个最有用的Linux命令</a> (0)</li><li><a href="http://www.rickyzhu.com/765_vimperator.html" title="类似于vi的Firefox插件-vimperator">类似于vi的Firefox插件-vimperator</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/1945_linux-system-and-performance.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Oracle Database 11gR2 for HP-UX and AIX released</title>
		<link>http://www.rickyzhu.com/1894_11-2-for-aix-and-hpi.html</link>
		<comments>http://www.rickyzhu.com/1894_11-2-for-aix-and-hpi.html#comments</comments>
		<pubDate>Wed, 23 Dec 2009 02:50:46 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=1894</guid>
		<description><![CDATA[Oracle Database 11gR2 for HP-UX and AIX released today 
至此，Tier1的主要平台包括Linux32/64, Solaris.Sparc, Solaris.X64, HPI, AIX.PPC 已经悉数发布了，除了Windows，可能还要在等等。
下载地址
Oracle Database 11g Release 2
Standard Edition, Standard Edition One, and Enterprise Edition

&#40;11.2.0.1.0&#41;
&#160;Linux x86 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Disk 1, Disk 2 &#40;2.1 GB&#41; &#124; See All &#40;Including Client, Gateways, Grid Infrastructure, more&#41;
&#160;Linux [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle Database 11gR2 for HP-UX and AIX released today </p>
<p>至此，Tier1的主要平台包括Linux32/64, Solaris.Sparc, Solaris.X64, HPI, AIX.PPC 已经悉数发布了，除了Windows，可能还要在等等。</p>
<p><a href="http://www.oracle.com/technology/software/products/database/index.html">下载地址</a></p>
<p>Oracle Database 11g Release 2<br />
Standard Edition, Standard Edition One, and Enterprise Edition</p>
<div class="dean_ch" style="white-space: wrap;">
<p><span class="br0">&#40;</span><span class="nu0">11.2</span><span class="nu0">.0</span><span class="nu0">.1</span><span class="nu0">.0</span><span class="br0">&#41;</span><br />
&nbsp;Linux x86 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Disk <span class="nu0">1</span>, Disk <span class="nu0">2</span> <span class="br0">&#40;</span><span class="nu0">2.1</span> GB<span class="br0">&#41;</span> | See All <span class="br0">&#40;</span>Including Client, Gateways, Grid Infrastructure, <span class="kw2">more</span><span class="br0">&#41;</span><br />
&nbsp;Linux x86<span class="nu0">-64</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Disk <span class="nu0">1</span>, Disk <span class="nu0">2</span> <span class="br0">&#40;</span><span class="nu0">2.2</span> GB<span class="br0">&#41;</span> | See All <span class="br0">&#40;</span>Including Client, Gateways, Grid Infrastructure, <span class="kw2">more</span><span class="br0">&#41;</span><br />
&nbsp;Solaris <span class="br0">&#40;</span>SPARC<span class="br0">&#41;</span> <span class="br0">&#40;</span><span class="nu0">64</span>-bit<span class="br0">&#41;</span> Disk <span class="nu0">1</span>, Disk <span class="nu0">2</span> <span class="br0">&#40;</span><span class="nu0">2.3</span> GB<span class="br0">&#41;</span> | See All <span class="br0">&#40;</span>Including Client, Gateways, Grid Infrastructure, <span class="kw2">more</span><span class="br0">&#41;</span><br />
&nbsp;Solaris <span class="br0">&#40;</span>x86<span class="nu0">-64</span><span class="br0">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Disk <span class="nu0">1</span>, Disk <span class="nu0">2</span> <span class="br0">&#40;</span><span class="nu0">2.2</span> GB<span class="br0">&#41;</span> | See All <span class="br0">&#40;</span>Including Client, Gateways, Grid Infrastructure, <span class="kw2">more</span><span class="br0">&#41;</span><br />
&nbsp;HP-UX Itanium &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Disk <span class="nu0">1</span>, Disk <span class="nu0">2</span> <span class="br0">&#40;</span><span class="nu0">2.3</span> GB<span class="br0">&#41;</span> | See All <span class="br0">&#40;</span>Including Client, Gateways, Grid Infrastructure, <span class="kw2">more</span><span class="br0">&#41;</span><br />
&nbsp;AIX <span class="br0">&#40;</span>PPC64<span class="br0">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Disk <span class="nu0">1</span>, Disk <span class="nu0">2</span> <span class="br0">&#40;</span><span class="nu0">2.2</span> GB<span class="br0">&#41;</span> | See All <span class="br0">&#40;</span>Including Client, Gateways, Grid Infrastructure, <span class="kw2">more</span><span class="br0">&#41;</span> </p>
<p>&nbsp;</p></div>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/1990_oraclesun-product-line.html" title="Oracle+Sun Product Line">Oracle+Sun Product Line</a> (3)</li><li><a href="http://www.rickyzhu.com/1975_oracle-clear-oracle-sun-deal.html" title="欧盟批准Oracle收购SUN">欧盟批准Oracle收购SUN</a> (1)</li><li><a href="http://www.rickyzhu.com/1841_patchset-reference.html" title="Oracle Patchset Reference">Oracle Patchset Reference</a> (2)</li><li><a href="http://www.rickyzhu.com/1817_11-2-for-solairs-release.html" title="11.2.0.1.0 on Solaris.Sparc64 and Solaris.X64 released">11.2.0.1.0 on Solaris.Sparc64 and Solaris.X64 released</a> (0)</li><li><a href="http://www.rickyzhu.com/1792_metalink.html" title="Metalink即将退休">Metalink即将退休</a> (4)</li><li><a href="http://www.rickyzhu.com/915_11-2-crs-resource.html" title="Oracle Database 11gR2 Clusterware之资源">Oracle Database 11gR2 Clusterware之资源</a> (0)</li><li><a href="http://www.rickyzhu.com/908_oraclesun-vs-ibm.html" title="Oracle+Sun VS IBM">Oracle+Sun VS IBM</a> (1)</li><li><a href="http://www.rickyzhu.com/898_11-2-crsprocesses.html" title="Oracle Database 11gR2 Clusterware之后台进程">Oracle Database 11gR2 Clusterware之后台进程</a> (1)</li><li><a href="http://www.rickyzhu.com/895_oracle-database-11gr2-released.html" title="Oracle Database 11gR2 Released">Oracle Database 11gR2 Released</a> (1)</li><li><a href="http://www.rickyzhu.com/882_troubleshoot-crs-10204-1.html" title="Troubleshoot CRS 10.2.0.4 on EL5 (1)">Troubleshoot CRS 10.2.0.4 on EL5 (1)</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/1894_11-2-for-aix-and-hpi.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Shell中的[]</title>
		<link>http://www.rickyzhu.com/1891_test-in-shel.html</link>
		<comments>http://www.rickyzhu.com/1891_test-in-shel.html#comments</comments>
		<pubDate>Thu, 17 Dec 2009 05:55:59 +0000</pubDate>
		<dc:creator>ricky.zhu</dc:creator>
				<category><![CDATA[脚本语言]]></category>

		<guid isPermaLink="false">http://www.rickyzhu.com/?p=1891</guid>
		<description><![CDATA[Shell中的[],没太搞明白，请高手指点。

ricky@ricky-desktop:~$ a=0
ricky@ricky-desktop:~$ if &#91; $a &#93;; then
&#62; echo &#34;Gooooood&#34;
&#62; else
&#62; echo &#34;Baaaaaaad&#34;
&#62; fi
Gooooood
ricky@ricky-desktop:~$ a=1
ricky@ricky-desktop:~$ if &#91; $a &#93;; then echo &#34;Gooooood&#34;; else echo &#34;Baaaaaaad&#34;; fi
Gooooood
ricky@ricky-desktop:~$ a=&#34;string&#34;
ricky@ricky-desktop:~$ if &#91; $a &#93;; then echo &#34;Gooooood&#34;; else echo &#34;Baaaaaaad&#34;; fi
Gooooood
ricky@ricky-desktop:~$ a=
ricky@ricky-desktop:~$ if &#91; $a &#93;; then echo &#34;Gooooood&#34;; else echo &#34;Baaaaaaad&#34;; fi
Baaaaaaad
ricky@ricky-desktop:~$ a=100
ricky@ricky-desktop:~$ if &#91; $a &#93;; then [...]]]></description>
			<content:encoded><![CDATA[<p>Shell中的[],没太搞明白，请高手指点。</p>
<div class="dean_ch" style="white-space: wrap;">
<p>ricky@ricky-desktop:~$ <span class="re2">a=</span><span class="nu0">0</span><br />
ricky@ricky-desktop:~$ <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re1">$a</span> <span class="br0">&#93;</span>; <span class="kw1">then</span><br />
&gt; <span class="kw3">echo</span> <span class="st0">&quot;Gooooood&quot;</span><br />
&gt; <span class="kw1">else</span><br />
&gt; <span class="kw3">echo</span> <span class="st0">&quot;Baaaaaaad&quot;</span><br />
&gt; <span class="kw1">fi</span><br />
Gooooood<br />
ricky@ricky-desktop:~$ <span class="re2">a=</span><span class="nu0">1</span><br />
ricky@ricky-desktop:~$ <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re1">$a</span> <span class="br0">&#93;</span>; <span class="kw1">then</span> <span class="kw3">echo</span> <span class="st0">&quot;Gooooood&quot;</span>; <span class="kw1">else</span> <span class="kw3">echo</span> <span class="st0">&quot;Baaaaaaad&quot;</span>; <span class="kw1">fi</span><br />
Gooooood<br />
ricky@ricky-desktop:~$ <span class="re2">a=</span><span class="st0">&quot;string&quot;</span><br />
ricky@ricky-desktop:~$ <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re1">$a</span> <span class="br0">&#93;</span>; <span class="kw1">then</span> <span class="kw3">echo</span> <span class="st0">&quot;Gooooood&quot;</span>; <span class="kw1">else</span> <span class="kw3">echo</span> <span class="st0">&quot;Baaaaaaad&quot;</span>; <span class="kw1">fi</span><br />
Gooooood<br />
ricky@ricky-desktop:~$ <span class="re2">a=</span><br />
ricky@ricky-desktop:~$ <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re1">$a</span> <span class="br0">&#93;</span>; <span class="kw1">then</span> <span class="kw3">echo</span> <span class="st0">&quot;Gooooood&quot;</span>; <span class="kw1">else</span> <span class="kw3">echo</span> <span class="st0">&quot;Baaaaaaad&quot;</span>; <span class="kw1">fi</span><br />
Baaaaaaad<br />
ricky@ricky-desktop:~$ <span class="re2">a=</span><span class="nu0">100</span><br />
ricky@ricky-desktop:~$ <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re1">$a</span> <span class="br0">&#93;</span>; <span class="kw1">then</span> <span class="kw3">echo</span> <span class="st0">&quot;Gooooood&quot;</span>; <span class="kw1">else</span> <span class="kw3">echo</span> <span class="st0">&quot;Baaaaaaad&quot;</span>; <span class="kw1">fi</span><br />
Gooooood<br />
ricky@ricky-desktop:~$ <span class="kw3">unset</span> a<br />
ricky@ricky-desktop:~$ <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re1">$a</span> <span class="br0">&#93;</span>; <span class="kw1">then</span> <span class="kw3">echo</span> <span class="st0">&quot;Gooooood&quot;</span>; <span class="kw1">else</span> <span class="kw3">echo</span> <span class="st0">&quot;Baaaaaaad&quot;</span>; <span class="kw1">fi</span><br />
Baaaaaaad<br />
ricky@ricky-desktop:~$ </p>
<p>&nbsp;</p></div>
<p><ins datetime="2009-12-18T02:24:48+00:00"><br />
多些几位大虾的指点，上面如果用string存在不存在来解释，那么下面怎么解释：</p>
<pre code="bash">
ricky@ricky-desktop:~$ a=1
ricky@ricky-desktop:~$ if [ ! $a ] ; then echo "Goooooood"; else echo "Baaaaaad"; fi
Baaaaaad
ricky@ricky-desktop:~$ a=0
ricky@ricky-desktop:~$ if [ ! $a ] ; then echo "Goooooood"; else echo "Baaaaaad"; fi
Baaaaaad
ricky@ricky-desktop:~$ a=true
ricky@ricky-desktop:~$ if [ ! $a ] ; then echo "Goooooood"; else echo "Baaaaaad"; fi
Baaaaaad
ricky@ricky-desktop:~$ a=false
ricky@ricky-desktop:~$ if [ ! $a ] ; then echo "Goooooood"; else echo "Baaaaaad"; fi
Baaaaaad
ricky@ricky-desktop:~$ 
</pre>
<p></ins></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.rickyzhu.com/2003_handy-awk.html" title="Handy one-liners for awk">Handy one-liners for awk</a> (0)</li><li><a href="http://www.rickyzhu.com/1830_vim.html" title="Learning Vim">Learning Vim</a> (0)</li><li><a href="http://www.rickyzhu.com/901_read-file-in-shell.html" title="Shell中读取文件">Shell中读取文件</a> (0)</li><li><a href="http://www.rickyzhu.com/890_linux-vs-solaris-dat.html" title="Linux/Solair对时间的处理">Linux/Solair对时间的处理</a> (1)</li><li><a href="http://www.rickyzhu.com/488_good-unix-habit.html" title="Unix高手的另外十个习惯">Unix高手的另外十个习惯</a> (1)</li><li><a href="http://www.rickyzhu.com/480_varable-replace-in-sed.html" title="sed中如何引用变量">sed中如何引用变量</a> (2)</li><li><a href="http://www.rickyzhu.com/467_shell-exam.html" title="Shell综合水平测试">Shell综合水平测试</a> (0)</li><li><a href="http://www.rickyzhu.com/444_cluster-console-script.html" title="Clusterware Console脚本分享">Clusterware Console脚本分享</a> (0)</li><li><a href="http://www.rickyzhu.com/441_not-use-cshell.html" title="十大原因告诉你不要使用CShell">十大原因告诉你不要使用CShell</a> (0)</li><li><a href="http://www.rickyzhu.com/415_linux-test-and-compare.html" title="Linux Bash 测试和比较函数">Linux Bash 测试和比较函数</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.rickyzhu.com/1891_test-in-shel.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
