LC_ALL=C fgrep -A 5 -B 5 'findtest' targetfile
27G左右的文件中查找,用时仅需几分钟。
按多个条件满足其一查询:
LC_ALL=C fgrep -A 5 -B 5 -E 'findtesta|findtestb' targetfile
参考资料: [1] https://stackoverflow.com/questions/13913014/grepping-a-huge-file-80gb-any-way-to-speed-it-up [2] https://unix.stackexchange.com/questions/37313/how-do-i-grep-for-multiple-patterns-with-pattern-having-a-pipe-character