<?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>孙立文的博客 &#187; Shell</title>
	<atom:link href="http://sunliwen.com/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://sunliwen.com</link>
	<description>Never lose my passion!</description>
	<lastBuildDate>Sat, 21 Jan 2012 05:16:52 +0000</lastBuildDate>
	<language>zh</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>如同统计代码行数</title>
		<link>http://sunliwen.com/2008/12/how-to-count-lines-of-code/</link>
		<comments>http://sunliwen.com/2008/12/how-to-count-lines-of-code/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 17:26:13 +0000</pubDate>
		<dc:creator>Liwen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Metrics]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://thinklouder.cn/?p=427</guid>
		<description><![CDATA[在Javaeye有一些讨论，其中比较简单的方法是用shell脚本： find . -type f -iname &#34;*.java&#34; -exec cat &#123;&#125; \; &#124; wc -l    如果不需要太精确的信息，这一结果已经足够说明工作量了。 ohloh.net这个网站开源了一个很棒的代码统计工具ohcount 安装： sudo apt-get instal ohcount 试验一下： liwen@cube:~/$ svn checkout http://rur-ple.googlecode.com/svn/trunk/ rur-ple-read-only liwen@cube:~/rur-ple-read-only$ ohcount Examining 720 file&#40;s&#41; &#160; Ohloh Line Count Summary &#160; Language Files Code Comment Comment % Blank Total ---------------- ----- --------- --------- --------- --------- --------- html 285 26993 420 1.5% 6553 33966 python 29 4027 1015 20.1% 642 5684 [...]]]></description>
			<content:encoded><![CDATA[<p>在Javaeye有一些<a href="http://www.javaeye.com/topic/186968">讨论</a>，其中比较简单的方法是用shell脚本：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . -type f -iname <span style="color: #ff0000;">&quot;*.java&quot;</span> -exec <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \; <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -l   </pre></div></div>

<p>如果不需要太精确的信息，这一结果已经足够说明工作量了。</p>
<p><a href="http://www.ohloh.net/">ohloh.net</a>这个网站开源了一个很棒的代码统计工具<a href="http://www.ohloh.net/p/ohcount">ohcount</a></p>
<p>安装：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> instal ohcount</pre></div></div>

<p>试验一下：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">liwen<span style="color: #000000; font-weight: bold;">@</span>cube:~<span style="color: #000000; font-weight: bold;">/</span>$ <span style="color: #c20cb9; font-weight: bold;">svn</span> checkout http:<span style="color: #000000; font-weight: bold;">//</span>rur-ple.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span> rur-ple-read-only
liwen<span style="color: #000000; font-weight: bold;">@</span>cube:~<span style="color: #000000; font-weight: bold;">/</span>rur-ple-read-only$ ohcount
Examining <span style="color: #000000;">720</span> <span style="color: #c20cb9; font-weight: bold;">file</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
                          Ohloh Line Count Summary                          
&nbsp;
Language          Files       Code    Comment  Comment <span style="color: #000000; font-weight: bold;">%</span>      Blank      Total
<span style="color: #660033;">----------------</span>  <span style="color: #660033;">-----</span>  <span style="color: #660033;">---------</span>  <span style="color: #660033;">---------</span>  <span style="color: #660033;">---------</span>  <span style="color: #660033;">---------</span>  <span style="color: #660033;">---------</span>
html                <span style="color: #000000;">285</span>      <span style="color: #000000;">26993</span>        <span style="color: #000000;">420</span>       <span style="color: #000000;">1.5</span><span style="color: #000000; font-weight: bold;">%</span>       <span style="color: #000000;">6553</span>      <span style="color: #000000;">33966</span>
python               <span style="color: #000000;">29</span>       <span style="color: #000000;">4027</span>       <span style="color: #000000;">1015</span>      <span style="color: #000000;">20.1</span><span style="color: #000000; font-weight: bold;">%</span>        <span style="color: #000000;">642</span>       <span style="color: #000000;">5684</span>
css                   <span style="color: #000000;">7</span>        <span style="color: #000000;">180</span>         <span style="color: #000000;">39</span>      <span style="color: #000000;">17.8</span><span style="color: #000000; font-weight: bold;">%</span>         <span style="color: #000000;">34</span>        <span style="color: #000000;">253</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>                  <span style="color: #000000;">1</span>         <span style="color: #000000;">55</span>         <span style="color: #000000;">31</span>      <span style="color: #000000;">36.0</span><span style="color: #000000; font-weight: bold;">%</span>         <span style="color: #000000;">19</span>        <span style="color: #000000;">105</span>
xml                   <span style="color: #000000;">1</span>         <span style="color: #000000;">21</span>          <span style="color: #000000;">0</span>       <span style="color: #000000;">0.0</span><span style="color: #000000; font-weight: bold;">%</span>          <span style="color: #000000;">3</span>         <span style="color: #000000;">24</span>
shell                 <span style="color: #000000;">2</span>          <span style="color: #000000;">4</span>          <span style="color: #000000;">0</span>       <span style="color: #000000;">0.0</span><span style="color: #000000; font-weight: bold;">%</span>          <span style="color: #000000;">0</span>          <span style="color: #000000;">4</span>
<span style="color: #660033;">----------------</span>  <span style="color: #660033;">-----</span>  <span style="color: #660033;">---------</span>  <span style="color: #660033;">---------</span>  <span style="color: #660033;">---------</span>  <span style="color: #660033;">---------</span>  <span style="color: #660033;">---------</span>
Total               <span style="color: #000000;">325</span>      <span style="color: #000000;">31280</span>       <span style="color: #000000;">1505</span>       <span style="color: #000000;">4.6</span><span style="color: #000000; font-weight: bold;">%</span>       <span style="color: #000000;">7251</span>      <span style="color: #000000;">40036</span></pre></div></div>

<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="ckepop">
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_douban"></a>
	<a class="jiathis_button_instapaper"></a>
	<a class="jiathis_button_stubleupon"></a>
	<a href="http://www.jiathis.com/share?uid=1544311" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript">var jiathis_config = {data_track_clickback:true};</script>
<script type="text/javascript" src="http://v2.jiathis.com/code_mini/jia.js?uid=1544311" charset="utf-8"></script>
<!-- JiaThis Button END --></div><hr />
<p>
<small>
Tags: <a href="http://sunliwen.com/tag/metrics/" rel="tag">Metrics</a>, <a href="http://sunliwen.com/tag/shell/" rel="tag">Shell</a><br/>
<a href="http://sunliwen.com/2008/12/how-to-count-lines-of-code/#comments-heading">没有评论</a>
</small>
</p>]]></content:encoded>
			<wfw:commentRss>http://sunliwen.com/2008/12/how-to-count-lines-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

