How to use conditional control flow in awk
<p>I have a file whose content is like:</p>

<pre><code>...
... Precision is ill-defined and being set to 0.0 due to no predicted samples ...
...
Score metric (precision_score): 0.0
...
</code></pre>

<p>where the line containing <code>Precision is ill-defined and being set to 0.0 due to no predicted samples</code> may or may not exist, and the line containing <code>Score metric (precision_score):</code> may or may not exist.</p>

<p>I want to use AWK to create a variable <code>precision</code>, and </p>

<ul>
<li><p>if the line containing <code>Precision is ill-defined and being set to 0.0 due to no predicted samples</code> exists, set the value of <code>precision</code> to <code>inf</code>, </p></li>
<li><p>otherwise, if  the line containing <code>Score metric (precision_score):</code> exists, set the value of <code>precision</code> to the number following <code>Score metric (precision_score):</code></p></li>
</ul>

<p>I wonder how to implement that in awk? Thanks.</p>