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 }
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In
awk, you can write two statements in one line separated by;(semi-colon)Otherwize, you should put them into separated lines:
To print the variables, you just add
printbefore the variables:As I said, you can put them all in one line:
It’s too long!
printalso accepts multiple arguments, so tryprint num_gold, wt_gold.