title: AWK - Remove last item out of list
body: <p>I'm trying to get the PID's of a certain service. I'm trying to do that with the following command:</p>
  
  <pre><code>ps aux | grep 'DynamoDBLocal' | awk '{print $2}'
  </code></pre>
  
  <p>Gives output:</p>
  
  <pre><code>1021
  1022
  1161
  </code></pre>
  
  <p>This returns me 3 PID's, 2 of the service that I want, and 1 for the grep it just did. I would like to remove the last PID (the one from the grep) out of the list.</p>
  
  <p>How can I achieve this?</p>