[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



find . -type f -exec wc -l {} \; 

Or, to get a _total_ number of lines,

find . -type f -exec cat {} \; | wc -l

Will work. You can often avoid using xargs(1) with shell looping
constructs, and it can be a good idear because xargs(1) will arbitrarily
group the filenames and pass them in wads to your program. In this case
that is ok, but I've seen places where this becomes an annoyance.

-- CHS

On Tue, 2004-03-16 at 12:57, Bridges, Doug wrote:
> And we have a winner.
> 
> That worked like a charm.  Xargs seems to be one the most powerful tools in Linux.
> 
> Doug
> 
> -----Original Message-----
&gt; From: ale-bounces at ale.org [<a  rel="nofollow" href="mailto:ale-bounces";>mailto:ale-bounces</a> at ale.org]On Behalf Of Mike
&gt; Murphy
&gt; Sent: Tuesday, March 16, 2004 12:40 PM
&gt; To: Atlanta Linux Enthusiasts
&gt; Subject: Re: [ale] Simple script question
&gt; 
&gt; 
&gt; find . -type f |xargs cat |wc -l ??
&gt; 
&gt; seems to work on the absurdly small test directory I created.
&gt; 
&gt; Mke
&gt; 
&gt; 
&gt; Bridges, Doug wrote:
&gt; &gt; I am trying to write a simple script that will recursively give me a line count of all of the files in a directory.  Here is the command I am trying:
&gt; &gt; 
&gt; &gt; wc -l &lt; cat `find . -type f -name &quot;*&quot;`
&gt; &gt; 
&gt; &gt; When I do this, I get:
&gt; &gt; bash: cat: No such file or directory
&gt; &gt; 
&gt; &gt; 
&gt; &gt; I suspect that some of the files might be too deep, or not exist.  

&gt; Also, I am doing this on cygwin, I don't know if this is some 

&gt; windows bug creeping in.
&gt; &gt; 
&gt; &gt; Doug
&gt; &gt; 
&gt; &gt; 
&gt; &gt; 
&gt; &gt; _______________________________________________________
&gt; &gt; 
&gt; &gt; NOTICE:  This e-mail message and all attachments transmitted with it 
&gt; &gt; may contain legally privileged and confidential information intended 
&gt; &gt; solely for the use of the addressee.  If the reader of this message is not 
&gt; &gt; the intended recipient, you are hereby notified that any reading, 
&gt; &gt; dissemination, distribution, copying, or other use of this message or its 
&gt; &gt; attachments is strictly prohibited.  If you have received this message in 
&gt; &gt; error, please notify the sender immediately by telephone 
&gt; &gt; (404-881-7000) or by electronic mail (postmaster at alston.com), and 
&gt; &gt; delete this message and all copies and backups thereof.  Thank you.
&gt; &gt; _______________________________________________________
&gt; &gt; 
&gt; &gt; _______________________________________________
&gt; &gt; Ale mailing list
&gt; &gt; Ale at ale.org
&gt; &gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00577" href="msg00577.html">[ale] Simple script question</a></strong>
<ul><li><em>From:</em> DBridges at alston.com (Bridges, Doug)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00581.html">[ale] Adaptec 2940UW bios updates</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00583.html">[ale] Simple script question</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00577.html">[ale] Simple script question</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00579.html">[ale] Linux Show, &lt;GeorgiaLinux Expo&gt;</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00582"><strong>Date</strong></a></li>
<li><a href="threads.html#00582"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>