“ls”命令、CSH 的列表太长

发布于 2024-11-16 06:40:35 字数 328 浏览 4 评论 0原文

我想获取多个目录中所有 ofl 类型文件的列表。我使用了以下命令:

ls RESULTS/*/quakesim/iecrud/quake/fgb/stflt/*.ofl

但收到一条消息:/bin/ls: Argument list too long. 这样的文件有 1600 多个。有没有办法仍然获取文件列表?

编辑:

我需要文件的路径,而不仅仅是有多少个wc是为了尝试查看我有多少文件而不用“污染”我的屏幕1600 多个路径。

I want to get a list of all my files of ofl type in several directories. I used the fallowing command:

ls RESULTS/*/quakesim/iecrud/quake/fgb/stflt/*.ofl

but I got a message: /bin/ls: Argument list too long. There are a little more than 1600 such files. Is there a way to still get the list of files?

EDIT:

I need the paths to the files and not just how many are there the wc was as a try to see how many files I have without "polluting" my screen with 1600+ paths.

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

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

发布评论

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

评论(3

笑梦风尘 2024-11-23 06:40:36

这可能很脏,但它适合我的需求并在我的能力范围内。我不认为它执行得很快,但它让我可以继续我的一天。

ls | grep jpg | <something>

我得到了 90,000 个 jpg 长列表,并将它们通过管道传输到 avconv 以生成延时摄影。

我以前使用的是 ls *.jpg| avconv 在我遇到这个问题之前。

This might be dirty but it works for my needs and within my competency. I don't think it performs very quickly but it allowed me to get on with my day.

ls | grep jpg | <something>

I was getting a 90,000 long list of jpgs and piping them to avconv to generate a timelapse.

I was previously using ls *.jpg| avconv before I ran into this issue.

深海夜未眠 2024-11-23 06:40:36

您可以制作一个快速的 bash 脚本,为两颗星之一迭代从 a 到 z 的不同字母,然后,对于每个结果,将 wc 的结果添加到每次迭代的当前总数中,然后返回结果。

是否可以工作

[a-m]*
[o-z]*

您还可以查看仅使用:在两个不同的命令上 。可能更简单,尽管我不知道参数数量的限制。

You could make a quick bash script that iterates through different letters from a to z for one of your two stars, then, for each results, you add the result from wc to the current total for each itteration and you return the result.

You could also see if it would work just using:

[a-m]*
[o-z]*

on just two different commands. Might be simplier, although I do not know the limit of number of arguments.

溇涏 2024-11-23 06:40:35

使用 find 而不是 ls.

示例:(假设您当前的工作目录是 RESULTS 的父目录)

find . -name "RESULTS/*/quakesim/iecrud/quake/fgb/stflt/*.ofl" -print

第二个选项:

find . -打印| egrep '.ofl$'

Use find instead of ls.

Example: (assuming your current working directory is the parent of RESULTS)

find . -name "RESULTS/*/quakesim/iecrud/quake/fgb/stflt/*.ofl" -print

Second option:

find . -print | egrep '.ofl$'

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