如何递归搜索HDFS子文件夹中的术语?

发布于 2025-01-17 09:01:03 字数 498 浏览 5 评论 0原文

我希望能够在HDFS中特定目录中的所有子目录和文件中搜索字符串模式。这就是它的外观-HADOOP

FS -LS/MARCAC24/

DRWXRWXR-X用户超级组0 00:59 2022-03-24 March24-00

drwxrwxrwxrwxr-X 2022-03-24 3月24-01

drwxrwxr-x用户超级组0 02:59 2022-03-24 March24-02

DRWXRWXRWXRWXR-X 03-24 March24-03

drwxrwxr-x用户超级组0 04:59 2022-03-24 March24-04

如何搜索所有这些子目录的术语,例如用户或客户? 我的搜索查询不起作用

hadoop fs -cat -r /march24 /* | grep -i -e用户-e客户

I want to be able to search for a pattern of string inside all the sub-directories and files in specific directory in HDFS. This is how it looks like -

hadoop fs -ls /MARCH24/

drwxrwxr-x user supergroup 0 00:59 2022-03-24 March24-00

drwxrwxr-x user supergroup 0 01:59 2022-03-24 March24-01

drwxrwxr-x user supergroup 0 02:59 2022-03-24 March24-02

drwxrwxr-x user supergroup 0 03:59 2022-03-24 March24-03

drwxrwxr-x user supergroup 0 04:59 2022-03-24 March24-04

How do i search through all these subdirectories for a term like user or customer?
My search query doesn't work

hadoop fs -cat -R /MARCH24/* | grep -i -e user -e customer

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

桃气十足 2025-01-24 09:01:03

用于查找文件的 Unix 命令名为find。您没有提供任何示例输入/输出,因此我们只能建议这样做:

find /MARCH24 -type f -exec grep -iE 'user|customer' {} +

如果这不是您想要的,请参阅 findgrep 手册页。

The Unix command to find files is named find. You didn't provide any sample input/output so we can't do more than suggest this:

find /MARCH24 -type f -exec grep -iE 'user|customer' {} +

and if that's not what you want then see the find and grep man pages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文