Assignment expressions
An assignment is an expression that stores a value in a variable.The simplest assignment operator is =, the equals sign. It stores the value of the right-hand-side operand as such.The assignment statement syntax is as follows:
<variable> or <field> or <array> = <constant> or <expression> or
The basic variable assignment is represented by the equals sign, =.Whatever value was assigned earlier is forgotten and the new value is assigned.For example, we assigna value to variable x=10 as follows:
$ awk 'BEGIN{ x=10; print "Number x is : ", x}'The output on execution of the preceding code is as follows:
Number x is : 10Assignmentcan store string values as well. For example,now we declare a variable message and store the string Welcome to Awk Programming. To store this string, we use two more variables and then concatenate themas follows:
$ vi assign.awk BEGIN { greet = "Welcome " ; lang = "Awk Programming"; message = greet "to "...