﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-开心就好-文章分类-script language</title><link>http://www.cppblog.com/shaovie/category/2728.html</link><description>做最好的自己</description><language>zh-cn</language><lastBuildDate>Wed, 21 May 2008 14:04:48 GMT</lastBuildDate><pubDate>Wed, 21 May 2008 14:04:48 GMT</pubDate><ttl>60</ttl><item><title>linuxsir 上牛人写的获取QQ天气预的shell</title><link>http://www.cppblog.com/shaovie/articles/16407.html</link><dc:creator>崔少伟</dc:creator><author>崔少伟</author><pubDate>Thu, 14 Dec 2006 00:32:00 GMT</pubDate><guid>http://www.cppblog.com/shaovie/articles/16407.html</guid><wfw:comment>http://www.cppblog.com/shaovie/comments/16407.html</wfw:comment><comments>http://www.cppblog.com/shaovie/articles/16407.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/shaovie/comments/commentRss/16407.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shaovie/services/trackbacks/16407.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">[</span>
				<span style="COLOR: #0000ff">No</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #800000">539</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #800000">21</span>
				<span style="COLOR: #000000">:</span>
				<span style="COLOR: #800000">32</span>
				<span style="COLOR: #000000">:</span>
				<span style="COLOR: #800000">52</span>
				<span style="COLOR: #000000"> bash ]</span>
				<span style="COLOR: #008000">#</span>
				<span style="COLOR: #008000"> cat myweather.sh<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#! /bin/bash<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /># 修改了处理过程和优化了速度<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /># 经过修改已经支持城市代码和城市名<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /># 支持同时查询多个城市天气的查询</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />city_code_file</span>
				<span style="COLOR: #000000">=</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">/linux/xuexi/bash/code_city.db</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />cd </span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">tmp<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />usage()<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />echo </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">Usage: `basename $0` [codes/citys] </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />echo<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />cat </span>
				<span style="COLOR: #000000">&lt;&lt;</span>
				<span style="COLOR: #000000"> CITY<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">1</span>
				<span style="COLOR: #000000">       香港    </span>
				<span style="COLOR: #800000">2</span>
				<span style="COLOR: #000000">       澳门            </span>
				<span style="COLOR: #800000">17</span>
				<span style="COLOR: #000000">      哈尔滨  </span>
				<span style="COLOR: #800000">28</span>
				<span style="COLOR: #000000">      乌鲁木齐        </span>
				<span style="COLOR: #800000">56</span>
				<span style="COLOR: #000000">      西宁<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">57</span>
				<span style="COLOR: #000000">      兰州    </span>
				<span style="COLOR: #800000">69</span>
				<span style="COLOR: #000000">      呼和浩特        </span>
				<span style="COLOR: #800000">78</span>
				<span style="COLOR: #000000">      银川    </span>
				<span style="COLOR: #800000">82</span>
				<span style="COLOR: #000000">      石家庄          </span>
				<span style="COLOR: #800000">84</span>
				<span style="COLOR: #000000">      太原<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">103</span>
				<span style="COLOR: #000000">     长春    </span>
				<span style="COLOR: #800000">115</span>
				<span style="COLOR: #000000">     沈阳            </span>
				<span style="COLOR: #800000">125</span>
				<span style="COLOR: #000000">     北京    </span>
				<span style="COLOR: #800000">127</span>
				<span style="COLOR: #000000">     天津            </span>
				<span style="COLOR: #800000">140</span>
				<span style="COLOR: #000000">     济南<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">150</span>
				<span style="COLOR: #000000">     拉萨    </span>
				<span style="COLOR: #800000">166</span>
				<span style="COLOR: #000000">     成都            </span>
				<span style="COLOR: #800000">179</span>
				<span style="COLOR: #000000">     昆明    </span>
				<span style="COLOR: #800000">186</span>
				<span style="COLOR: #000000">     西安            </span>
				<span style="COLOR: #800000">189</span>
				<span style="COLOR: #000000">     郑州<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">211</span>
				<span style="COLOR: #000000">     武汉    </span>
				<span style="COLOR: #800000">212</span>
				<span style="COLOR: #000000">     重庆            </span>
				<span style="COLOR: #800000">218</span>
				<span style="COLOR: #000000">     长沙    </span>
				<span style="COLOR: #800000">227</span>
				<span style="COLOR: #000000">     贵阳            </span>
				<span style="COLOR: #800000">232</span>
				<span style="COLOR: #000000">     桂林<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">244</span>
				<span style="COLOR: #000000">     南京    </span>
				<span style="COLOR: #800000">248</span>
				<span style="COLOR: #000000">     合肥            </span>
				<span style="COLOR: #800000">252</span>
				<span style="COLOR: #000000">     上海    </span>
				<span style="COLOR: #800000">255</span>
				<span style="COLOR: #000000">     杭州            </span>
				<span style="COLOR: #800000">264</span>
				<span style="COLOR: #000000">     南昌<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">276</span>
				<span style="COLOR: #000000">     福州    </span>
				<span style="COLOR: #800000">280</span>
				<span style="COLOR: #000000">     台北            </span>
				<span style="COLOR: #800000">287</span>
				<span style="COLOR: #000000">     厦门    </span>
				<span style="COLOR: #800000">292</span>
				<span style="COLOR: #000000">     广州            </span>
				<span style="COLOR: #800000">295</span>
				<span style="COLOR: #000000">     南宁<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">296</span>
				<span style="COLOR: #000000">     深圳    </span>
				<span style="COLOR: #800000">303</span>
				<span style="COLOR: #000000">     海口<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />CITY<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />echo<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">exit</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #800000">0</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />}<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />getweather()<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">grep</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">&lt;td height=\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #800000">23</span>
				<span style="COLOR: #000000">\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">""</span>
				<span style="COLOR: #000000"> ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">html </span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">txt<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        city</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">$(</span>
				<span style="COLOR: #0000ff">grep</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">&lt;td height=\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #800000">23</span>
				<span style="COLOR: #000000">\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">""</span>
				<span style="COLOR: #000000"> ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">txt </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">n </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">1p</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/[[:lower:][:digit:]\&lt;\&gt;="\/_\. ]//g</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        weat</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">$(</span>
				<span style="COLOR: #0000ff">grep</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">&lt;td height=\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #800000">23</span>
				<span style="COLOR: #000000">\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">""</span>
				<span style="COLOR: #000000"> ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">txt </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">n </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">2p</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/.*center\"&gt;//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/&lt;.*//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        temp</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">$(</span>
				<span style="COLOR: #0000ff">grep</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">&lt;td height=\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #800000">23</span>
				<span style="COLOR: #000000">\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">""</span>
				<span style="COLOR: #000000"> ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">txt </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">n </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">4p</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/.*&gt;//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        wind</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">$(</span>
				<span style="COLOR: #0000ff">grep</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">&lt;td height=\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #800000">23</span>
				<span style="COLOR: #000000">\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">""</span>
				<span style="COLOR: #000000"> ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">txt </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">n </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">6p</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/.*center\"&gt;//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/&lt;.*//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        viol</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">$(</span>
				<span style="COLOR: #0000ff">grep</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">&lt;td height=\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #800000">23</span>
				<span style="COLOR: #000000">\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">""</span>
				<span style="COLOR: #000000"> ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">txt </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">n </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">8p</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/.*center\"&gt;//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/&lt;.*//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        aire</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">$(</span>
				<span style="COLOR: #0000ff">grep</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">&lt;td height=\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #800000">23</span>
				<span style="COLOR: #000000">\</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">""</span>
				<span style="COLOR: #000000"> ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">txt </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">n </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">10p</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/.*center\"&gt;//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> sed </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">s/&lt;.*//</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />}<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />getall()<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        wget  </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">O </span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">tmp</span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">html  http</span>
				<span style="COLOR: #000000">://</span>
				<span style="COLOR: #000000">weather</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">qq</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">com</span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">inc</span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">ss${code}</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">htm </span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">dev</span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">null </span>
				<span style="COLOR: #800000">2</span>
				<span style="COLOR: #000000">&gt;&amp;</span>
				<span style="COLOR: #800000">1</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        getweather<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        showweather<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        rm </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">f ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">html  ss</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">txt </span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">dev</span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">null </span>
				<span style="COLOR: #800000">2</span>
				<span style="COLOR: #000000">&gt;&amp;</span>
				<span style="COLOR: #800000">1</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />}<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />showweather()<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">e </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">\t城  市:      $city</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">e </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">\t天  气:      $weat</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">e </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">\t温  度:      $temp</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">e </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">\t风  力:      $wind</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">e </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">\t空  气:      $aire</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">e </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">\t紫外线:      $viol</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />}<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #008000">#</span>
				<span style="COLOR: #008000">###### MAIN #########</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />[[ $</span>
				<span style="COLOR: #800000">1</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">-h</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> ]] </span>
				<span style="COLOR: #000000">||</span>
				<span style="COLOR: #000000"> [[ $</span>
				<span style="COLOR: #800000">1</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">--help</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> ]] </span>
				<span style="COLOR: #000000">&amp;&amp;</span>
				<span style="COLOR: #000000"> usage<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> [[ </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">z $</span>
				<span style="COLOR: #800000">1</span>
				<span style="COLOR: #000000"> ]];then<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        set </span>
				<span style="COLOR: #800000">103</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #800000">303</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />fi<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000"> citycode in </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">$@</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">;</span>
				<span style="COLOR: #0000ff">do</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        code</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">$(</span>
				<span style="COLOR: #0000ff">grep</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">w </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">$citycode</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">  </span>
				<span style="COLOR: #800080">$city_code_file</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> awk </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">{print $1}</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
				<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> [[ </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">n </span>
				<span style="COLOR: #800080">$code</span>
				<span style="COLOR: #000000"> ]];then<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />                getall<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">else</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />                echo </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">$citycode not invalid.</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />                usage<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        fi<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />done<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">exit</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #800000">0</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />[</span>
				<span style="COLOR: #0000ff">No</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #800000">540</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #800000">21</span>
				<span style="COLOR: #000000">:</span>
				<span style="COLOR: #800000">33</span>
				<span style="COLOR: #000000">:</span>
				<span style="COLOR: #800000">05</span>
				<span style="COLOR: #000000"> bash ]</span>
				<span style="COLOR: #008000">#</span>
				<span style="COLOR: #008000"> cat code_city.db</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #800000">1</span>
				<span style="COLOR: #000000"> 香港<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">2</span>
				<span style="COLOR: #000000"> 澳门<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">17</span>
				<span style="COLOR: #000000"> 哈尔滨<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">28</span>
				<span style="COLOR: #000000"> 乌鲁木齐<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">56</span>
				<span style="COLOR: #000000"> 西宁<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">57</span>
				<span style="COLOR: #000000"> 兰州<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">69</span>
				<span style="COLOR: #000000"> 呼和浩特<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">78</span>
				<span style="COLOR: #000000"> 银川<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">82</span>
				<span style="COLOR: #000000"> 石家庄<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">84</span>
				<span style="COLOR: #000000"> 太原<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">103</span>
				<span style="COLOR: #000000"> 长春<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">115</span>
				<span style="COLOR: #000000"> 沈阳<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">125</span>
				<span style="COLOR: #000000"> 北京<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">127</span>
				<span style="COLOR: #000000"> 天津<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">140</span>
				<span style="COLOR: #000000"> 济南<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">150</span>
				<span style="COLOR: #000000"> 拉萨<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">166</span>
				<span style="COLOR: #000000"> 成都<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">179</span>
				<span style="COLOR: #000000"> 昆明<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">186</span>
				<span style="COLOR: #000000"> 西安<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">189</span>
				<span style="COLOR: #000000"> 郑州<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">211</span>
				<span style="COLOR: #000000"> 武汉<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">212</span>
				<span style="COLOR: #000000"> 重庆<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">218</span>
				<span style="COLOR: #000000"> 长沙<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">227</span>
				<span style="COLOR: #000000"> 贵阳<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">232</span>
				<span style="COLOR: #000000"> 桂林<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">244</span>
				<span style="COLOR: #000000"> 南京<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">248</span>
				<span style="COLOR: #000000"> 合肥<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">252</span>
				<span style="COLOR: #000000"> 上海<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">255</span>
				<span style="COLOR: #000000"> 杭州<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">264</span>
				<span style="COLOR: #000000"> 南昌<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">276</span>
				<span style="COLOR: #000000"> 福州<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">280</span>
				<span style="COLOR: #000000"> 台北<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">287</span>
				<span style="COLOR: #000000"> 厦门<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">292</span>
				<span style="COLOR: #000000"> 广州<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">295</span>
				<span style="COLOR: #000000"> 南宁<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">296</span>
				<span style="COLOR: #000000"> 深圳<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #800000">303</span>
				<span style="COLOR: #000000"> 海口</span>
		</div>
<img src ="http://www.cppblog.com/shaovie/aggbug/16407.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shaovie/" target="_blank">崔少伟</a> 2006-12-14 08:32 <a href="http://www.cppblog.com/shaovie/articles/16407.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CU牛人的做品.收藏一下</title><link>http://www.cppblog.com/shaovie/articles/16354.html</link><dc:creator>崔少伟</dc:creator><author>崔少伟</author><pubDate>Wed, 13 Dec 2006 01:42:00 GMT</pubDate><guid>http://www.cppblog.com/shaovie/articles/16354.html</guid><wfw:comment>http://www.cppblog.com/shaovie/comments/16354.html</wfw:comment><comments>http://www.cppblog.com/shaovie/articles/16354.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/shaovie/comments/commentRss/16354.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shaovie/services/trackbacks/16354.html</trackback:ping><description><![CDATA[
		<span style="FONT-SIZE: 13px">
				<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<span style="COLOR: #008000">#</span>
						<span style="COLOR: #008000">!/bin/sh<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#ScriptName:rotate</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						</span>
						<span style="COLOR: #000000">[ $</span>
						<span style="COLOR: #008000">#</span>
						<span style="COLOR: #008000"> -ne 1 ] &amp;&amp; exit 1</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						</span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> [ </span>
						<span style="COLOR: #000000">!</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">s $</span>
						<span style="COLOR: #800000">1</span>
						<span style="COLOR: #000000"> ]<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />then<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        echo </span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">Usage:rotate datafile</span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">exit</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #800000">1</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />fi<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />row</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">`sed </span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">n </span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">$=</span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
						<span style="COLOR: #000000"> $</span>
						<span style="COLOR: #800000">1</span>
						<span style="COLOR: #000000">`<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />col</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">`awk </span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">NR==1{print NF}</span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
						<span style="COLOR: #000000"> $</span>
						<span style="COLOR: #800000">1</span>
						<span style="COLOR: #000000">`<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />awk </span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">v row</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #800080">$row</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">v col</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #800080">$col</span>
						<span style="COLOR: #000000"> </span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">{for(i=1;i&lt;=NF;i++)a[NR"-"i]=$i} END{ for(i=1;i&lt;=co<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />l;i++){ for(j=1;j&lt;=row;j++) printf("%s ",a[j"-"i]);printf("\n") } }</span>
						<span style="FONT-WEIGHT: bold; COLOR: #000000">'</span>
						<span style="COLOR: #000000"> $</span>
						<span style="COLOR: #800000">1</span>
				</div>
		</span>
		<span style="FONT-SIZE: 13px"># cat file<br />中 中 中 中 中<br />华 华 华 华 华<br />人 人 人 人 人<br />民 民 民 民 民<br />共 共 共 共 共<br />和 和 和 和 和<br />国 国 国 国 国<br /># rotate file<br />中 华 人 民 共 和 国<br />中 华 人 民 共 和 国<br />中 华 人 民 共 和 国<br />中 华 人 民 共 和 国<br />中 华 人 民 共 和 国</span>
<img src ="http://www.cppblog.com/shaovie/aggbug/16354.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shaovie/" target="_blank">崔少伟</a> 2006-12-13 09:42 <a href="http://www.cppblog.com/shaovie/articles/16354.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>