Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试查找我知道部分名称的文件,假设文件名的一部分是“abc”,但文件可能是 abc123 或 123abc 等...
但是,我无法使用通配符搜索的文件太多(我看到其他人谈论的文件太多错误,显然如果文件太多,您不能使用通配符)。
我听说可以使用 For 循环来实现这一点,但我似乎运气不佳。
find . -name '*abc*' -print
所以外壳不必扩展通配符。迭代结果:
while IFS= read -r filename; do do something with "$filename" done; < <(find . -name '*abc*' -print)
或者
find . -name '*abc*' -print | xargs some_command_that_takes_filenames_as_arguments