title: Awk script Can I assign a variable if a condition using awk command is met?
body: <p>hi in this simple script  I call a function usage() if there is a cron job owned by root.
  Is it possible to do an else statement within the awk, so when the condition is not met I call another function?
  Can you please provide an example? 
  Thx</p>
  
  <pre><code>usage ()
  {
  # Print usage
         echo "usage function"
  } 
  #
  
  export -f usage
  ps -ef | awk '{if ($0 ~ /crond/ &amp;&amp; $1 == "root") {system("/usr/bin/env bash -c usage")
  </code></pre>