1
00:00:01,020 --> 00:00:09,940
In this lecture we talk about a variable assignment and how to do Maat operations with variables assignment

2
00:00:10,000 --> 00:00:17,570
is pretty simple and it's the same as you know for a beshe when we go on for example into variable A

3
00:00:17,750 --> 00:00:27,010
assign value one and we use a equal sign one for string assignment when we want to assign a word or

4
00:00:27,010 --> 00:00:28,260
a sentence.

5
00:00:28,300 --> 00:00:34,920
We are using quotation marks if we want increment value of variable A.

6
00:00:35,260 --> 00:00:42,580
We just use plus plus or we can use a equal sign a plus one.

7
00:00:42,770 --> 00:00:47,790
The most common mud operations are very easy as you can see.

8
00:00:47,910 --> 00:00:51,950
Also we have more a matter of patience available for awk.

9
00:00:52,180 --> 00:01:01,860
But in most cases you will not need to then we can now practice some basic math and as now we won't

10
00:01:01,880 --> 00:01:16,590
do any file in both just live with the same as me in the BEGIN section and one plus one and we see that

11
00:01:16,590 --> 00:01:17,340
this is working.

12
00:01:17,350 --> 00:01:23,750
Outproduce is 2 now in six minus 1

13
00:01:26,730 --> 00:01:28,860
result is 5.

14
00:01:29,520 --> 00:01:32,130
We can do also easily some division

15
00:01:35,920 --> 00:01:37,640
and does all operates.

16
00:01:37,660 --> 00:01:38,650
Floating point

17
00:01:41,310 --> 00:01:42,810
yes it does.

18
00:01:43,500 --> 00:01:49,540
And we can also try to do some multiplication.

19
00:01:49,670 --> 00:01:53,660
So any type of operation can be done here.

20
00:01:53,670 --> 00:01:55,880
This is amazing.

21
00:01:56,940 --> 00:02:07,670
Now let's print number of records in a passport file and as a record separator I will use newline character.

22
00:02:08,640 --> 00:02:14,140
So in the BEGIN section I will define a record separator as a new line

23
00:02:20,910 --> 00:02:25,170
and in N.S. either print number of records.

24
00:02:25,170 --> 00:02:34,000
So in my case I have 41 record forty one lines.

25
00:02:34,100 --> 00:02:39,940
Now let's create a variable count inside BEGIN section.

26
00:02:40,190 --> 00:02:53,700
So in BEGIN section we will have a record separator which is equal to no line and you will have also

27
00:02:53,700 --> 00:02:54,880
a variable called

28
00:02:58,640 --> 00:03:01,830
which is equals to zero.

29
00:03:02,400 --> 00:03:10,530
And for each record be will increase counter the value by 1 in the main body section

30
00:03:14,960 --> 00:03:19,790
and in the section will print number of records.

31
00:03:19,790 --> 00:03:25,250
And also we'll print a variable count

32
00:03:28,330 --> 00:03:35,700
in the N.S. number of records and value of variable count should be the same because they are doing

33
00:03:35,730 --> 00:03:37,570
the same for each record.

34
00:03:37,630 --> 00:03:44,460
They increase in value by 1 and I can see same numbers here.

35
00:03:44,460 --> 00:03:46,320
Great.

36
00:03:46,380 --> 00:03:54,090
Now let's increase our variable count for each record by 2 instead of by only 1

37
00:04:03,340 --> 00:04:10,130
and we see that the variable count has now its value two times bigger than number of records.

38
00:04:10,150 --> 00:04:10,600
Great.
