use*_*995 8 unix shell hadoop file hdfs
是否可以将命令行中的文本写入Hadoop?
尝试执行类似于unix write/append to file命令的操作.
echo "hello world" > hello_world.txt
Run Code Online (Sandbox Code Playgroud)
在Hadoop土地上,我希望这可以工作,但命令却没有.
hadoop fs -appendToFile "foo bar" /dir/hadoop/hello_world.txt
hadoop fs -put "hello world" /dir/hadoop/hello_world.txt
Run Code Online (Sandbox Code Playgroud)
use*_*995 24
Hadoop文件说明appendToFile和put可以读取stdin
echo "hello world" | hadoop fs -appendToFile - /dir/hadoop/hello_world.txt
echo "hello world" | hadoop fs -put - /dir/hadoop/hello_world.txt