2017-10-11 146 views
0

嘗試從包含大量文件的位置獲取字符串。獲取誤差argument list too long,已經累xargs但有這些先進的關鍵字不支持獲取「參數列表太長」錯誤

grep 'hello' /file/collection/*/logs/*.log > ~/hello 
+0

相關:請問「參數列表太長」 適用於shell內建?](HTTPS ://sackoverflow.com/questions/47443380/does-argument-list-too-long-restriction-apply-to-shell-builtins) – codeforester

回答

0

試試這個

$ find /file/collection/*/logs/ -name "*.log" -type f -maxdepth 1 | xargs grep hello 
+0

Siju,「xargs」似乎沒有在這個環境下工作 –

+0

@PiyushWakhale請參閱https://stackoverflow.com/a/18647755/4082052 – Sundeep

+0

我刪除了-maxdepth標誌和我噸工作,thanx :) –