Hadoop HDFS命令学习笔记
cat
Usage: hadoop fs -cat [-ignoreCrc] URI [URI ...]
Copies source paths to stdout.
Options
- The -ignoreCrc option disables checkshum verification.
Example:
- hadoop fs -cat hdfs://nn1.example.com/file1 hdfs://nn2.example.com/file2
- hadoop fs -cat file:///file3 /user/hadoop/file4
Exit Code:
Returns 0 on success and -1 on error.
eg:
hadoop fs -cat /work/songwang4/kg/repair/result/sourceMovie/res/part* | grep results | wc -l
统计该路径下文件中含有多少 results字段
hadoop fs -cat /work/songwang4/kg/repair/result/sourceMovie/res/part* | grep -v results | wc -l
统计该路径下文件中含有多少没包含 results字段
hadoop fs -cat /work/songwang4/kg/repair/result/sourceMovie/res/part* | grep results > result.json
多个文件合并为一个
hadoop fs -put new1v1.json /work/songwang4/kg/repair/data/relation
上传新文件