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