1
00:00:01,800 --> 00:00:05,300
Now we can add some functionality into our script.

2
00:00:05,400 --> 00:00:14,190
So open our script and you'll see that in the case section for options Desch order a fix.

3
00:00:14,210 --> 00:00:19,160
We just wrote a first album and now we didn't start any information.

4
00:00:19,160 --> 00:00:21,170
A fixed parameter of a specified.

5
00:00:21,170 --> 00:00:23,070
So we need to change it.

6
00:00:23,280 --> 00:00:32,000
So assigned to variable FX Vol. 1 which represents that parameter fix was used by user.

7
00:00:32,360 --> 00:00:38,370
And of course if user didn't specify if experimentor the value of variable freak's should be different.

8
00:00:38,420 --> 00:00:46,200
So at the beginning just after use each function assign value 0 to variable fix and we can write command.

9
00:00:46,310 --> 00:00:56,970
So if frigs a variable is 0 do not perform for X and if it is a one perform fix.

10
00:00:57,000 --> 00:01:01,100
So now Vennochi know if fixed barometer was selected.

11
00:01:01,250 --> 00:01:08,070
And we can ask if a variable fix is equal to 1.

12
00:01:08,070 --> 00:01:13,000
That means if a user wants to perform fix.

13
00:01:13,680 --> 00:01:23,650
And also we can ask if some file was specified otherwise we would have no file for fixing space and

14
00:01:23,650 --> 00:01:35,940
tub's issues which would be Rebeck And if those conditions are true we can write to users fixing spaces

15
00:01:36,150 --> 00:01:39,700
at the beginning and at the end of lines.

16
00:02:04,990 --> 00:02:13,840
And now we use the knowledge from set lectures and fix space issue right now for a provided file.

17
00:02:13,960 --> 00:02:22,190
So we are using set with parameter I Ridgeville change provided file and we will do substitution.

18
00:02:22,330 --> 00:02:32,050
So if we find a space or stops at the end of file and those spaces and tabs can be represented by character

19
00:02:32,050 --> 00:02:44,830
class blank which matches space or type and this space or up can be at the end of file numerals time.

20
00:02:44,830 --> 00:02:53,830
So we need to use plus to by dollar sign representing end of line and those spaces and tabs at the end

21
00:02:53,860 --> 00:02:57,490
of line literally are replaced by nothing.

22
00:02:57,510 --> 00:03:07,530
So that basically means we will remove them and we also need to specify input file where changes will

23
00:03:07,530 --> 00:03:10,620
be done.

24
00:03:11,280 --> 00:03:15,150
So now we have fixed spaces at the end of line.

25
00:03:15,210 --> 00:03:16,840
And now we need to fix that.

26
00:03:16,890 --> 00:03:18,690
Also at the beginning.

27
00:03:19,240 --> 00:03:30,990
So match start of line followed by any space or up represented by character class blank and doe space

28
00:03:31,080 --> 00:03:35,580
or DAPs character can be present numerous time.

29
00:03:35,940 --> 00:03:39,210
And this if found will be replaced by nothing.

30
00:03:39,300 --> 00:03:49,600
We will just remove it and we will remove it from file represented by variable file and now when spaces

31
00:03:49,710 --> 00:03:54,080
issues are fixed we can print to users message.

32
00:03:54,180 --> 00:03:54,520
Dan

33
00:03:57,740 --> 00:04:06,890
so what we have done for OK's user specified file name and specified also fixed parameter we have fixed

34
00:04:06,890 --> 00:04:14,570
spaces and tabs at the beginning and at the end of each lines and by fixing space stop.

35
00:04:14,570 --> 00:04:19,030
If you mean that door spaces and tabs that are removed.

36
00:04:19,370 --> 00:04:23,840
So let's say that.

37
00:04:24,040 --> 00:04:27,450
But first create some testing file

38
00:04:32,210 --> 00:04:35,650
so I've put some text into this file.

39
00:04:35,900 --> 00:04:40,100
First line second line third line

40
00:04:42,770 --> 00:04:43,330
blah blah

41
00:04:49,310 --> 00:04:50,270
something here

42
00:04:54,610 --> 00:04:55,870
also something here

43
00:04:59,100 --> 00:04:59,700
very good

44
00:05:02,500 --> 00:05:06,060
and I love that line.

45
00:05:07,060 --> 00:05:09,940
And also some interesting Glenn

46
00:05:17,210 --> 00:05:24,050
and we can make some spaces and that's at the beginning or at the end of some lines

47
00:05:35,680 --> 00:05:39,990
and now we can say you defile.

48
00:05:40,060 --> 00:05:42,270
So let's test our script.

49
00:05:42,400 --> 00:05:45,250
If I specify only file

50
00:05:48,490 --> 00:05:51,270
I get no output as if we didn't right.

51
00:05:51,290 --> 00:05:52,930
Any logic for that option.

52
00:05:53,110 --> 00:06:00,790
But even he added fixed barometer we see message fixing spaces and that's dumb heavy really fix space

53
00:06:00,820 --> 00:06:01,520
issues.

54
00:06:01,660 --> 00:06:09,790
Let's open our test file to see and we see that there is no space for that.

55
00:06:09,940 --> 00:06:17,190
At the beginning or at the end of each line is this fixed barometer works perfectly.

56
00:06:17,230 --> 00:06:26,110
So in next lecture we can work on the feature how to display space and DAPs issues like that background.
