The value that you assign a variable can (Web hosting reseller)
The value that you assign a variable can also be the value of another variable or a field. For example, the following awk commands fruit=peach fruity=fruit set the value of the variables fruit and fruity to peach. In order to set the value of a variable to one of the fields parsed by awk, you need to use the standard field access operator. For example, the following awk command fruit=$1 sets the value of the variable fruit to the first field of the input line. Using Numeric Expressions You can also assign a variable the value of a numeric expression. Numeric expressions are commands used to add, subtract, multiply, and divide two numbers. Numeric expressions are constructed using the numeric operators given in Table 17.2. The numeric expressions are of the form num1 operator num2 Here num1 and num2 can be constants, such as 1 or 2, or variable names. A numeric expression performs the action specified by operator on num1 and num2 and returns the answer. For example, the following awk commands a=1 b=a+1 assign the value 2 to the variable b. Table 17.2 Numeric Operators in awk Operator Description + Add - Subtract * Multiply / Divide % Modulo (Remainder) ^ Exponentiation As an example of using numeric expressions, look at the following script that counts the number of blank lines in a file:
In case you need quality webspace to host and run your web applications, try our personal web hosting services.