user1436187
user1436187

Reputation: 3376

Using wc * to count the numer of lines of the files in the current directory

When I use wc * it shows warning for the directories.

Is it possible to filter the current directory and get only the list of files and pass it to the wc.

Upvotes: 1

Views: 48

Answers (2)

gariepy
gariepy

Reputation: 3674

Another way with find:

find . -maxdepth 1 -type f -exec wc {} \;

Upvotes: 2

anubhava
anubhava

Reputation: 784908

You can use find:

find . -maxdepth 1 -type f -print0 | xargs -0 wc -l

Or with gnu wc:

find . -maxdepth 1 -type f -print0 | wc --files0-from=- -l

Upvotes: 1

Related Questions