简体   繁体   English

从模式文件到目录中搜索的Grep无法正常工作

[英]Grep from pattern file to search in directory not working

I have a txt file called "optionsList.txt" with lines as such: 我有一个名为“ optionsList.txt”的txt文件,其内容如下:

00201205CA2A421F99B7E0E0B332921C
00AAFF650E9F42B987679AB21F1A5F0F
015CF25A44D047398E96A0BD7A06939E
00201205CA2A421F99B7E0E0B332921C
00AAFF650E9F42B987679AB21F1A5F0F
015CF25A44D047398E96A0BD7A06939E
016F0DFB04A24B5B92E50079CB15ADC7
022F3506A50F451682881080B31F9067
....

I am trying to use grep -F -f to find matches in the directory "./Options/" 我正在尝试使用grep -F -f在目录“ ./Options/”中查找匹配项

EDIT: this was the comman I'm using (sorry for not including it earlier): 编辑:这是我正在使用的逗号(很抱歉,较早不包含它):

grep -nr -Ff optionsList.txt  ./Options/

but the grep comes up with nothing. 但是grep却一无所获。

When I go a plain pattern grep 当我去一个普通模式grep

grep -nr 00AAFF650E9F42B987679AB21F1A5F0F ./Options/

I do see proper results like: 我确实看到正确的结果,例如:

./Options/ReportOptions.log.25:100331:2017/01/06 04:02:37.479 [7420] 00AAFF650E9F42B987679AB21F1A5F0F: Report.ExecuteJob Start
./Options/ReportOptions.log.25:100348:2017/01/06 04:02:38.988 [7420] 00AAFF650E9F42B987679AB21F1A5F0F: ExecuteAtOnce Before Call

Why is my grep command not working for the pattern file? 为什么我的grep命令不适用于特征码文件?

There is an utility on unix to remove char 13, '\\r' or ^M. UNIX上有一个实用程序可删除char 13,'\\ r'或^ M。

Syntax may vary 语法可能会有所不同

dos2unix optionsList.txt
dos2unix optionsList.txt optionsList.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM