在 hadoop 猫中,|头不工作

in hadoop cat, | head doesn't work

您好,我在 HDFS 中有一个 csv 文件,我想看一下。

这两个命令有效:

hadoop fs -cat hdfs://192.168.200.121:8020/python/DI.csv
hadoop fs -tail hdfs://192.168.200.121:8020/python/DI.csv

但是

hadoop fs -tail hdfs://192.168.200.121:8020/python/DI.csv | head

无法正常工作,出现错误:

'head' is not recognized as an internal or external command, operable program or batch file.

有人知道为什么吗?谢谢-

因为tail会从尾部开始显示数据,head会从顶部开始显示数据。

关键字...或批处理文件

您在 Windows,其中 head 不是命令。您可能获得的最接近的是 with PowerShell

hadoop fs -cat hdfs://192.168.200.121:8020/python/DI.csv | Select -First 20

但是,使用 Pig 或 Hive 之类的工具对 运行 SELECT + LIMIT 查询 CSV

会更有用