1
00:00:01,030 --> 00:00:06,880
In AUK he can display number of fields using a variable called an F.

2
00:00:06,950 --> 00:00:13,480
Remember that fields are items which are by default separated by space.

3
00:00:14,080 --> 00:00:20,430
So if we pass output of eco command one two three four into awk program

4
00:00:24,350 --> 00:00:32,070
we see that in our case we have four fields which is correct because we have fields 1 2 3 and 4

5
00:00:36,130 --> 00:00:45,360
if we prepared Dorsai in before and I have got printed string for.

6
00:00:45,540 --> 00:00:47,040
Why.

7
00:00:47,090 --> 00:00:50,910
Because don't assign is used for displaying fields.

8
00:00:51,020 --> 00:01:00,820
Dead means dead and F has a value of four and dollar sign for will display for field in our case.

9
00:01:00,860 --> 00:01:02,420
String for.

10
00:01:02,720 --> 00:01:10,400
So if we change do not assign an F to assign for if we get completely same result.

11
00:01:10,400 --> 00:01:14,180
What is really powerful here is the option to do math.

12
00:01:14,240 --> 00:01:21,860
So if we want to display a field which is before the bomb we can display a number of fields minus one

13
00:01:21,930 --> 00:01:30,290
which will print 3 and we can also continue in a similar way.

14
00:01:30,290 --> 00:01:36,700
For example number of fields minus 2 and we see displayed string 2.

15
00:01:37,670 --> 00:01:46,190
But if we say display field number of fields plus 2 or whatever else for example plus 1 which cannot

16
00:01:46,250 --> 00:01:49,500
exist because we have only four fields.

17
00:01:50,240 --> 00:01:53,020
The result is that we got nothing printed.

18
00:01:54,350 --> 00:01:59,950
Now we just play out table and for each line print number of fields

19
00:02:10,490 --> 00:02:17,150
so into awk main section will bring in an F

20
00:02:21,840 --> 00:02:28,380
and we see that each line of table of table file has three fields which is correct.

21
00:02:29,890 --> 00:02:39,190
We can of course make the printing more readable by printing something like number of fields in this

22
00:02:39,190 --> 00:02:40,310
line.

23
00:02:53,550 --> 00:02:54,260
And great.

24
00:02:54,280 --> 00:02:55,450
It works perfectly.
