1
00:00:01,480 --> 00:00:05,190
In this lecture we will see substitute command in action.

2
00:00:05,310 --> 00:00:09,330
But firstly what's the content of our test file table.

3
00:00:09,420 --> 00:00:18,000
Text we can for example the place name Jorm with name Richard.

4
00:00:18,170 --> 00:00:31,470
So what I said use one letter command as followed by Sri slushes and inside first two slices of right.

5
00:00:32,130 --> 00:00:34,550
And into replacement part right.

6
00:00:34,560 --> 00:00:40,250
Richard the input file will be table dot text

7
00:00:45,460 --> 00:00:49,550
and we see that in output we don't see John anywhere.

8
00:00:49,660 --> 00:00:57,640
He was replaced by Richard grade when we put in the content of profile we still see John here as set

9
00:00:57,700 --> 00:01:02,160
by default doesn't change input file.

10
00:01:02,170 --> 00:01:08,090
Now let's say we want to replace John with Richard but only on second line.

11
00:01:08,440 --> 00:01:11,520
So in other place before as commom

12
00:01:14,900 --> 00:01:17,100
Vitthal both Number two

13
00:01:23,130 --> 00:01:24,060
if Iranian

14
00:01:28,980 --> 00:01:35,400
We don't see any change as patterns on what was not found on second line.

15
00:01:35,400 --> 00:01:40,540
The same will be for faultline.

16
00:01:40,770 --> 00:01:44,280
But if you specify to do the change on line

17
00:01:50,640 --> 00:01:56,560
we see that John was replaced by Richard great.

18
00:01:56,560 --> 00:02:03,880
Now we can again display content of our testing file and let's say that we want to do a replacement

19
00:02:03,910 --> 00:02:10,030
for our president which will be from first to last line.

20
00:02:10,030 --> 00:02:19,100
So we are using as an address one comma

21
00:02:22,230 --> 00:02:31,760
dollar sign which means from first to last line and we will replace John with name Richard

22
00:02:37,720 --> 00:02:44,270
and it is working great again again print output of our file to see clearly.

23
00:02:44,320 --> 00:02:47,750
Is there if you can do some experiment.

24
00:02:47,780 --> 00:02:50,830
So firstly copy it they both file

25
00:02:55,720 --> 00:03:01,410
too tables sorry not.

26
00:03:02,280 --> 00:03:06,870
And now we can do replacement directly in input file.

27
00:03:06,870 --> 00:03:13,840
So we are using option I know out what should be printed to standard output here.

28
00:03:16,380 --> 00:03:24,780
So with that option we did option I would replace men John to Richard

29
00:03:29,170 --> 00:03:35,330
as an input file will be table so got text so no output is printed here.

30
00:03:35,350 --> 00:03:37,310
Which is correct.

31
00:03:37,990 --> 00:03:50,350
And if we show output of tables read the text we see that Richard is here instead of which on great.

32
00:03:50,600 --> 00:03:55,710
Now we can do some other examples on initial table file.

33
00:03:55,780 --> 00:03:59,770
So it's output using cut command

34
00:04:07,600 --> 00:04:15,380
and now imagine that your boss thought due to height age of partisans whose age is a greater density

35
00:04:15,860 --> 00:04:19,140
and you can hide it by three steps.

36
00:04:21,260 --> 00:04:29,510
So in our substitute command we need to say X which are very much set they are more so that need to

37
00:04:29,510 --> 00:04:36,890
be two numbers and first Vama will be in a strange city to 9.

38
00:04:37,010 --> 00:04:44,740
Second number can be represented by digital Clouse which represents any number from 0 to 9.

39
00:04:48,230 --> 00:04:55,490
Be aware that in this example I am assuming that no one will be older than 99.

40
00:04:55,610 --> 00:05:04,520
Otherwise we would need to adjust I guess a little bit and I guess we can replace if it's three steps.

41
00:05:04,810 --> 00:05:12,330
So even around the gray we see he didn't age four Peter who had 50.

42
00:05:12,430 --> 00:05:18,710
And for Mark who has said this theory this works perfectly.

43
00:05:19,190 --> 00:05:24,450
Now show again output of our testing file.

44
00:05:25,040 --> 00:05:29,300
And let's say that we want to replace.

45
00:05:29,460 --> 00:05:30,450
But then H.

46
00:05:30,480 --> 00:05:34,320
R. with three times printed h.

47
00:05:34,970 --> 00:05:43,180
So instead for printing three times h r we can use Surete times ampersand symbol

48
00:05:50,190 --> 00:05:52,630
and days unperson symbol represents.

49
00:05:52,680 --> 00:06:05,070
Just think that Menchie's directx and even the we see that in our food is three times splinted age are

50
00:06:05,350 --> 00:06:06,510
great.

51
00:06:06,740 --> 00:06:14,220
This ampersand symbol is a very helpful when you want to print something which matches require expressions

52
00:06:14,700 --> 00:06:18,190
while you don't know how that string looks like.
