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.
このテーマに関する最後の質問-私は約束します!! 私はさまざまなコマンドを試してきました。
文字列「bcs」が含まれ、161〜190の数字で終わるファイルをディレクトリで検索する必要があります。
例えば:
ls albcs182 albcs188
findコマンドを使用してbcs文字列を含むすべてのファイルを取得できますが、1つのコマンドで2つの文字列を検索するのに問題がありますか?
以下はすべてのファイル名で機能するはずです:
find -print0 | perl -ne 'INIT { $/ = "\0" } chomp; print "$_\n" if /bcs.*?(\d+)$/g && ($1>160 && $1<=190);'
ls | egrep ".*bcs.*(16[1-9]|1[7-8][0-9]|190)$"