March 2018
Beginner to intermediate
416 pages
9h 24m
English
The Ishift function returns the value of val, shifted to the left side by the count number of bits specified in the argument. 0s are shifted in from the right side. For example, let us left shift, or lshift, the decimal 5 once to illustrate how the lshift() function works:
5 = 101
lshift once = 1010, which is decimal 10
The following example shows how the lshift() functions work:
$ vi lshift.awkBEGIN { num1 = 5 count =1 result = lshift(num1,count) printf "lshift(%d,%d) = %d\n", num1, count, result
}$ awk -f lshift.awk
The output of the execution of the previous code is as follows:
lshift(5,1) = 10
Read now
Unlock full access