In awk you can run a command using variables from awk by saving the command to a variable first, then get line can be used to retrieve the result.
/condition/ {
    myVariable = "some value"
    CMDFILE = "echo "myVariable" | head"
    CMDFILE | getline myAnswer
    close(CMDFILE)
    print myAnswer
}

don’t forget the close statement!!,.

Advertisement