有什么方法可以使用 HDFS 命令将 hdfs 文件的文本内容复制到另一个文件系统中:
hadoop fs -text /user/dir1/abc.txt
我可以使用 -cat 或任何方法将 -text 的输出打印到另一个文件中吗?:
hadoop fs -cat /user/deepak/dir1/abc.txt
有什么方法可以使用 HDFS 命令将 hdfs 文件的文本内容复制到另一个文件系统中:
hadoop fs -text /user/dir1/abc.txt
我可以使用 -cat 或任何方法将 -text 的输出打印到另一个文件中吗?:
hadoop fs -cat /user/deepak/dir1/abc.txt
谢谢我确实在 hadoop-home lib 文件夹中使用了流媒体 jar 示例,如下所示:
hadoop -jar hadoop-streaming.jar -input hdfs://namenode:port/path/to/sequencefile \
-output /path/to/newfile -mapper "/bin/cat" -reducer "/bin/cat" \
-file "/bin/cat" -file "/bin/cat" \
-inputformat SequenceFileAsTextInputFormat
如果您想计算 hdfs 序列文件中的行数,可以使用“/bin/wc”。
作为一般命令行提示,您可以将|
其用于另一个程序或>
文件>>
,例如
# Will output to standard output (console) and the file /my/local/file
# this will overwrite the file, use ... tee -a ... to append
hdfs dfs -text /path/to/file | tee /my/local/file
# Will redirect output to some other command
hdfs dfs -text /path/to/file | some-other-command
# Will overwrite /my/local/file
hdfs dfs -text /path/to/file > /my/local/file
# Will append to /my/local/file
hdfs dfs -text /path/to/file >> /my/local/file
您可以使用以下内容:
hadoop dfs -copyToLocal /HDFS/file /user/deepak/dir1/abc.txt
hadoop dfs -getmerge /HDFS/file /user/deepak/dir1/abc.txt
hadoop dfs -get /HDFS/file /user/deepak/dir1/abc.txt