Extract details that are in both using awk or sed <p>I'm trying to write a script which needs to extract details that exist on both versions. </p> <pre><code>ABC-A1 1.0 tomcat BBC-A1 2.0 tomcat CAD-A1 1.0 tomcat ABC-A1 2.0 tomcat BBC-A1 2.0 tomcat </code></pre> <p>In the above data , I would like to extract the names that exist in both 1.0 and 2.0 ( that will be <code>ABC-A1</code> and <code>BBC-A1</code> )</p> <p>How can I do this using <em>awk or sed</em> or any other?</p>