简体   繁体   中英

Grep from pattern file to search in directory not working

I have a txt file called "optionsList.txt" with lines as such:

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

I am trying to use grep -F -f to find matches in the directory "./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.

When I go a plain pattern 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?

There is an utility on unix to remove char 13, '\\r' or ^M.

Syntax may vary

dos2unix optionsList.txt
dos2unix optionsList.txt optionsList.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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