bash - 如何存储/*url* 的实际名称?

标签 bash unix hadoop hdfs

我正在将脚本转换为 HDFS (Hadoop),并且我有这个 cmd:

    tail -n+$indexedPlus1 $seedsDir/*url* | head -n$it_size > $it_seedsDir/urls

使用 HDFS,我需要使用 -get 获取文件,这很有效。
bin/hadoop dfs -get $seedsDir/*url* .

但是我不知道下载的文件名是什么,更不用说我想存储在 $local_seedsDir/url 中了。
我可以知道吗?

亲吻告诉我:
bin/hadoop dfs -get $seedsDir/*url* $local_seedsDir/urls

即只需在本地将文件命名为 url。

最佳答案

url=`echo bin/hadoop dfs -get urls-input/MR6/*url* .`

然后 tail 和 head 从 url 中提取实际文件名并将其存储在 $urls
rm $urls

但除此之外,就 KISS

关于bash - 如何存储/*url* 的实际名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5464382/

相关文章:

hadoop - Spark Map Task 内存消耗巨大

linux - 400 错误请求安装 Perlbrew 本身

arrays - 回显引用的数组

regex - Bash - 如何计算指令数?

unix - Shell 脚本 — 获取 <date> 之后修改的所有文件

linux - 尾部-f + grep?

regex - grep 和 sed 正则表达式含义 - 从网页中提取 url

unix 命令 'tail' 丢失选项 '--line-buffered'

hadoop - Hadoop YARN:如何管理I/O

hadoop - 确保在Kafka Connect中交付一次