title: Delete duplicate lines only if they match a pattern
body: <p><a href="https://stackoverflow.com/questions/1444406/how-can-i-delete-duplicate-lines-in-a-file-in-unix">This question</a> has a great answer saying you can use <code>awk '!seen[$0]++' file.txt</code> to delete non-consecutive duplicate lines from a file. How can I delete non-consecutive duplicate lines from a file only if they match a pattern? e.g. only if they contain the string "#####"</p>
  
  <p>Example input</p>
  
  <pre><code>deleteme.txt ##########
  1219:                            'PCM BE PTP'
  deleteme.txt ##########
  1221:                          , 'PCM FE/MID PTP UT','PCM IA 1 PTP'
  deleteme2.txt ##########
  1222:                          , 'PCM BE PTP UT'
  1221:                          , 'PCM FE/MID PTP UT','PCM IA 1 PTP'
  deleteme2.txt ##########
  1223:                          , 'PCM BE PTP'
  1221:                          , 'PCM FE/MID PTP UT','PCM IA 1 PTP'
  deleteme2.txt ##########
  1225:                          , 'PCM FE/MID PTP'
  </code></pre>
  
  <p>Desired output</p>
  
  <pre><code>deleteme.txt ##########
  1219:                            'PCM BE PTP'
  1221:                          , 'PCM FE/MID PTP UT','PCM IA 1 PTP'
  deleteme2.txt ##########
  1222:                          , 'PCM BE PTP UT'
  1221:                          , 'PCM FE/MID PTP UT','PCM IA 1 PTP'
  1223:                          , 'PCM BE PTP'
  1221:                          , 'PCM FE/MID PTP UT','PCM IA 1 PTP'
  1225:                          , 'PCM FE/MID PTP'
  </code></pre>