First, thanks for the reply.
Second, I never used awk much, if at all, so I have little experience with it
(unlike grep which I have used in a few occasions), which is why I didn't
think of using it.
Third, I will need your help to, first, understand the code you wrote. It
seems to me, it is comparing each number to the entire document, am I
correct? I ask this because the intention was to only compare each number to
the next line.
Basically find common numbers between first and second lines, then second and
third, then third and fourth, etc etc.