I created a file (testimdb) with the following content:
film: heat. year: 1995. director: michael mann. actors: al pacino, robert de niro, val kilmer film: the godfather part ii. year: 1974. director: francis coppola. actors: al pacino, robert de niro, diane keaton, robert duvall film: casino. year: 1995. director: martin scorsese. actors: robert de niro, sharon stone, joe pesci film: carlito's way. year: 1993. director: brian de palma. actors: al pacino, sean penn
I can grep for all movies starring both Pacino and De Niro (grep 'pacino\|de niro' /root/testimdb). this results in displaying all the films containing either of their names.
However, I want to exclude any film that does not star the both of them -- together in the same movie only. So, my grep search example above does not work for me as it correctly returns results that contain both stars in the same movies (heat, godfather 2) AND it also retrieves results of films of theirs not staring the other. For example, "Casino" stars De Niro, but not Pacino, and "Carlito's Way" only stars Pacino, but not De Niro.
How can I get the grep to display only results of Pacino and De Niro starring jointly in a film, ignoring all other results?