touch 'x y z'
1. 上传文件
1.1 %20
替换:
使用
%20
代替文件名中的每一个空格
hdfs dfs -put x%20y%20%20z {dest path}
1.2 |
戏法
使用管道符
|
巧妙连接cat
和put
cat x\ y\ \ z | hdfs dfs -put - /tmp/test/x\ y\ \ z
cat x\ y\ \ z | hdfs dfs -put - '/tmp/test/x y z'
cat x\ y\ \ z | hdfs dfs -put - "/tmp/test/x y z"
cat 'x y z' | hdfs dfs -put - /tmp/test/x\ y\ \ z
cat 'x y z' | hdfs dfs -put - '/tmp/test/x y z'
cat 'x y z' | hdfs dfs -put - "/tmp/test/x y z"
cat "x y z" | hdfs dfs -put - /tmp/test/x\ y\ \ z
cat "x y z" | hdfs dfs -put - '/tmp/test/x y z'
cat "x y z" | hdfs dfs -put - "/tmp/test/x y z"
2. 下载文件
2.1 \
转义:
在文件名中的每一个空格前加上转义符
\
hdfs dfs -get {dest path}/x\ y\ \ z
2.2 单引号'
/ 双引号"
:
使用单引号
'
/双引号"
将文件全路径包含在内
hdfs dfs -get '{dest path}/x y z'
hdfs dfs -get "{dest path}/x y z"
传送门:stack overflow