title: Powershell to find specific pattern
body: <p>I am trying to extract only my JIRA issue numbers from a text file, eliminating duplicates. This is good in Shell script: </p>
  
  <pre><code> cat /tmp/jira.txt | grep -oE '^[A-Z]+-[0-9]+' | sort -u
  </code></pre>
  
  <p>But I want to use Powershell and tried this </p>
  
  <pre><code>$Jira_Num=Get-Content /tmp/jira.txt |  Select-String -Pattern '^[A-Z]+-[0-9]+' &gt; "$outputDir\numbers.txt"
  </code></pre>
  
  <p>But, this returns the entire line also not eliminating the duplicates.  I tried regex but I am new to powershell don't know how exactly to use it. Can someone help please. </p>
  
  <p>Sample Jira.txt file</p>
  
  <pre><code> PRJ-2303 Modified the artifactName
   PRJ-2303 Modified comment
   JIRA-1034 changed url to tag the prj projects
   JIRA-1000 for release 1.1
   JIRA-1000 Content modification
  </code></pre>
  
  <p>Expected output</p>
  
  <pre><code> PRJ-2303
   JIRA-1034
   JIRA-1000
  </code></pre>