How to count lines in a file on hdfs command?

后端 未结 3 443
梦如初夏
梦如初夏 2020-12-13 19:26

I have a file on HDFS that I want to know how many lines are. (testfile)

In linux, I can do:

wc -l 

Can I do somet

3条回答
  •  执笔经年
    2020-12-13 20:03

    Total number of files: hadoop fs -ls /path/to/hdfs/* | wc -l

    Total number of lines: hadoop fs -cat /path/to/hdfs/* | wc -l

    Total number of lines for a given file: hadoop fs -cat /path/to/hdfs/filename | wc -l

提交回复
热议问题