[英]grep from file (-f) using regex
I'm trying to use grep -f A.txt B.txt
to find lines matching a regular expression. 我正在尝试使用
grep -f A.txt B.txt
查找与正则表达式匹配的行。 When I do this, however, it matches every line in file B and I don't understand why. 但是,当我这样做时,它与文件B中的每一行都匹配,我不明白为什么。
A.txt: A.TXT:
'[Bb]lop'
B.txt: B.txt:
blop
Blop
doop
bop
output of grep -f A.txt B.txt
grep -f A.txt B.txt
输出
blop
Blop
doop
bop
Any ideas? 有任何想法吗?
如果模式匹配文件的末尾有换行符,则grep会将空行匹配到所有内容,并返回文件中的每一行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.