---

Exercise #6: Set Variables in Scripts

“When you need to set variables, you can do that in the BEGIN
section of an awk script. Here the variable firstuser is set to
1000. The BEGIN section sets that variable and it is then used
later in the script.

awk file: variable

BEGIN {firstuser=1000}

/1000/ {print;

print “UserID of the First User Created: ” firstuser}

END {print “Total Number of Records: ” NR}


Complete Story