1
00:00:01,170 --> 00:00:08,250
Will come to this lecture about Alk. great oak we can take our scripts to next level as you will see

2
00:00:08,250 --> 00:00:08,830
later.

3
00:00:09,030 --> 00:00:10,850
But what is an org.

4
00:00:11,740 --> 00:00:20,020
It is a program that searches files for lines that contain certain patterns and then performs operation

5
00:00:20,080 --> 00:00:25,540
describe in all body on line with that button.

6
00:00:25,900 --> 00:00:31,360
Or we can use awk to perform some operation on the chosen line.

7
00:00:31,360 --> 00:00:33,750
And now we can see basic structure of all.

8
00:00:33,760 --> 00:00:35,330
It is pretty simple.

9
00:00:35,380 --> 00:00:38,320
We are starting with keyboard awk.

10
00:00:38,500 --> 00:00:43,890
Then we specify what operations we want to happen on each line of specific files.

11
00:00:45,110 --> 00:00:51,050
And what is the structure of that operations you would like to execute for each line.

12
00:00:51,050 --> 00:00:54,100
It is divided into three parts.

13
00:00:54,110 --> 00:01:02,030
First section is BEGIN section and everything you type here will be executed before performing operations

14
00:01:02,270 --> 00:01:04,870
on each line of a specific file.

15
00:01:05,810 --> 00:01:08,770
Next section is the most important one.

16
00:01:08,870 --> 00:01:18,110
This section will be executed for each line of specific file and the last section ISDE and section despiser

17
00:01:18,410 --> 00:01:25,210
is executed after org processed all lines of a specific file.

18
00:01:25,220 --> 00:01:28,900
Here is some examples how the code looks like.

19
00:01:28,960 --> 00:01:35,690
Notice that we don't specify file names here but instead we want the awk program to be run just for

20
00:01:35,690 --> 00:01:39,730
a specific line for specific output of each month.

21
00:01:40,100 --> 00:01:42,220
So what is happening here.

22
00:01:42,310 --> 00:01:49,000
Firstly output of eco command is used as an input into our program.

23
00:01:49,010 --> 00:01:58,580
Then the org executes commands in the BEGIN section then commands in main they are performed for output

24
00:01:58,640 --> 00:01:59,960
of eco command.

25
00:02:00,140 --> 00:02:10,780
And finally because we don't have more lines more inputs the N.S. is better from we can of course use

26
00:02:10,780 --> 00:02:15,190
only one section of our program as we can see here.

27
00:02:15,460 --> 00:02:23,110
Here we don't have BEGIN and END section we only performing the main section for specific output from

28
00:02:23,200 --> 00:02:28,690
eco command in awk program best features doesn't work.

29
00:02:28,780 --> 00:02:35,770
And what's more important if we are using a completely new language in all body for example we don't

30
00:02:35,770 --> 00:02:39,690
use eco but mainly we are using print command.

31
00:02:39,790 --> 00:02:48,130
We have also different structure of if our statement and the same is for for loop and many more and

32
00:02:48,520 --> 00:02:50,590
more is also new for us.

33
00:02:50,690 --> 00:02:56,060
If we have completely new features available we can call for specific lines.

34
00:02:56,140 --> 00:03:02,340
For example we have here variable an F which represents number of fields.

35
00:03:02,530 --> 00:03:07,990
Then we have an R which represents number of records and so on.

36
00:03:09,290 --> 00:03:17,280
I can feel that this short arc summary may sound hard and difficult for you but please check for following

37
00:03:17,350 --> 00:03:23,800
lectures where we will focus on each part of all programming and you will find it quite easy.

38
00:03:23,840 --> 00:03:25,970
We're going step by step.
