title: how to collect maximum and minimum values from a grep search pattern using bash?
body: <p>I have a huge log.txt file from which I need to calculate the maximum and minimum values.</p>
  <pre><code> 0-00:42:35.598 &lt;tc_testcase&gt;:[DEFAULT]:[PRINT]: tc_testcase.c:8963: VERIFY_CASE: range: X_PER_Y_USER_RANGE_0[1](a, 1)=121, (0)=0, (25000)=25000, (ok)
   0-00:42:35.598 &lt;tc_testcase&gt;:[DEFAULT]:[PRINT]: tc_testcase.c:8963: VERIFY_CASE: range: X_PER_Y_USER_RANGE_0[1](a, 1)=256879, (0)=0, (25000)=25000, (ok)
   0-00:42:35.598 &lt;tc_testcase&gt;:[DEFAULT]:[PRINT]: tc_testcase.c:8963: VERIFY_CASE: range: X_PER_Y_USER_RANGE_0[1](a, 1)=2300, (0)=0, (25000)=25000, (ok)
   0-00:42:35.598 &lt;tc_testcase&gt;:[DEFAULT]:[PRINT]: tc_testcase.c:8963: VERIFY_CASE: range: X_PER_Y_USER_RANGE_0[1](a, 1)=56897132, (0)=0, (25000)=25000, (ok)
   0-00:42:35.598 &lt;tc_testcase&gt;:[DEFAULT]:[PRINT]: tc_testcase.c:8963: VERIFY_CASE: range: X_PER_Y_USER_RANGE_0[1](a, 1)=12579, (0)=0, (25000)=25000, (ok)
   0-00:42:35.598 &lt;tc_testcase&gt;:[DEFAULT]:[PRINT]: tc_testcase.c:8963: VERIFY_CASE: range: X_PER_Y_USER_RANGE_0[1](a, 1)=968746, (0)=0, (25000)=25000, (ok)
  </code></pre>
  <p>so, as the first step I started to collect lines as below into a separate file with the below grep command and later to sort it:</p>
  <pre><code> grep -Po '.X_PER_Y_USER_RANGE_0.*[1].*(a, 1).\K.*' file.txt &gt; collect.txt
  </code></pre>
  <p>But the output I receive is quite different. It looks something like this:-</p>
  <pre><code>=121, (25000)=25000, (ok)
  =256879, (25000)=25000, (ok)
  =2300, (25000)=25000, (ok)
  =56897132, (25000)=25000, (ok)
  =12579, (25000)=25000, (ok)
  =968746, (25000)=25000, (ok)
  </code></pre>
  <p>Expected should be:-</p>
  <pre><code>121
  256879
  2300
  56897132
  12579
  968746
  </code></pre>
  <p>Can anyone help to modify the current grep command i'm using to collect the values as the expected output</p>