何百もの xml ファイルにいくつかのキーワードが存在するかどうかを検索したいのですが、次のスクリプトを使用してこれを処理したいと考えています。
#!/usr/local/bin/bash
find . -name '*.xml' |xargs egrep -n "HERE IS LONG LIST(word1|word2|...)" > result
次のようなエラー メッセージが表示されました。
xargs: a single arg was greater than the max arglist size of 2048 characters
そのため、長いリストを 3 つの部分に変更すると、次のようになります。
#!/usr/local/bin/bash
find . -name '*.xml' |xargs egrep -n "LIST_1" > result
find . -name '*.xml' |xargs egrep -n "LIST_2" >> result
find . -name '*.xml' |xargs egrep -n "LIST_3" >> result
パターンリストの分離を避けるためにこれを処理するより良い方法はありますか?