matching exact lines in files

Jim Showalter <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization ComputeC
Message-ID <[email protected]>
I hope questions about 'diff' and 'vim' are on topic in this
newsgroup.  If not, please suggest a more appropriate group.

Is there a way, using diff, to display only the lines in text file
'a', let's call it a.txt, that match lines in text file 'b', b.txt?

Specifically, I want is to find all lines in a.txt that match any of
the following three groups of lines in b.txt:

1-0
[Event "ICC"]

0-1
[Event "ICC"]

1/2-1/2
[Event "ICC"]


Occurrences in a.txt, such as:

1-0

[Event "ICC"]


should not match because there is an intervening blank line.

I have tried experimenting with the "--line-format" switch, such as
"--old-line-format=%=" ("%=" should match common lines).  But while I
think I'm on the right track, I get screens of wall-to-wall "%=%=%=".

Also, if anyone knows how I can accomplish this easily with vim, that
would even be better.  But I have never been able to figure out how
to include end-of-lines or blank-lines in vim searches.

Or maybe I have to use some other tools?

Anybody?
-- 
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  Everything should be made as simple as possible, but not simpler.
_/                           -- Albert Einstein
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.