Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Count of lines for each file in HDFS

Highlighted

Count of lines for each file in HDFS

New Contributor

how can I get the count of multiple csv files that resides in a single directory?

Exp: $ hadoop fs -cat /user/cloudera/output/*.csv | wc -l

Expectation: Should display each file count separately

 

Tried the below command as well which is giving me the total count of all the files but not the count of each file individually. Could you please help me on this?

hadoop fs -ls /user/cloudera/output/*.csv | awk '{print $8}' | xargs hadoop fs -cat | wc -l

Don't have an account?
Coming from Hortonworks? Activate your account here