且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

grep多个模式单个文件参数列表太长

更新时间:2023-12-04 19:39:34

您可以通过将模式放在文件中,并对grep使用 -f 命令行选项来避免此问题.

You can avoid the problem by putting the patterns in a file, and using the -f command line option to grep.

最方便的方法是将每个替代项放在文件的单独行中:

The most convenient is to put each alternative in a separate line of the file:

^.\{6\}0000000012345
^.\{6\}0000000012543

调用

grep -f patterns.txt somelargeFile.txt > outputFile.txt