Linux Today: Linux News On Internet Time.

More on LinuxToday

Exercise #6: Set Variables in Scripts

Mar 03, 2011, 19:06 (0 Talkback[s])


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

"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

Related Stories: