You're viewing a comment by daniel and its responses.

daniel Permalink
March 14, 2012, 05:04

Great articles!
However I tried this in my workspace:

find . -name *.java|xargs awk 'END {print NR}'

hoping to get the total line number of all java files...

The output I got was:

334810
290871
272952
243138
247081

I don't know why it got multiple numbers

and when I tried wc -l, the total line number was:246911...
any idea?

Comment Responses

Gaurav Permalink
May 26, 2012, 07:23

Hi danial use this it will give u correct count

find . -name *.java| awk 'END {print NR}'

when you are using xargs it is taking the count of all content present in side a particular file, that's why it is giving the count of content present in files

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "network_92": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.