Apollo Connecting the World

Diligence and Intelligence

Count number of lines of all files in a directory

leave a comment »

In Linux, given a directory “dir”, if you want to count number of lines of all files (e.g. .txt files) in the directory (inclucing sub-directory), simply type this command:

find ./ -name ‘*.txt’ | xargs wc -l

 

NOTE: This method works in Fedora 12

Written by apollozhao

2011/04/05 at 18:39

Posted in Linux, wc

Tagged with , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: