What does the semicolon represent in an awk action?
awk, linux
Solution
In `awk`, you can write two statements in one line separated by `;`(semi-colon)
{ num_gold++; wt_gold += $2 }
Otherwize, you should put them into separated lines:
{
num_gold++
wt_gold += $2
}
To print the variables, you just add `print` before the variables:
{
num_gold++
wt_gold += $2
print num_gold
print wt_gold
}
As I said, you can put them all in one line:
{ num_gold++; wt_gold += $2; print num_gold; print wt_gold; }
It's too long!
`print` also accepts multiple arguments, so try `print num_gold, wt_gold`.
Problem
I'm attempting to decipher the action in the following `awk` statement specifically what the `;` after the first user defined variable refers to. ``` { num_gold++; wt_gold += $2 } ``` `