In this lecture we will see substitute command in action.
But firstly what's the content of our test file table.
Text we can for example the place name Jorm with name Richard.
So what I said use one letter command as followed by Sri slushes and inside first two slices of right.
And into replacement part right.
Richard the input file will be table dot text
and we see that in output we don't see John anywhere.
He was replaced by Richard grade when we put in the content of profile we still see John here as set
by default doesn't change input file.
Now let's say we want to replace John with Richard but only on second line.
So in other place before as commom
Vitthal both Number two
if Iranian
We don't see any change as patterns on what was not found on second line.
The same will be for faultline.
But if you specify to do the change on line
we see that John was replaced by Richard great.
Now we can again display content of our testing file and let's say that we want to do a replacement
for our president which will be from first to last line.
So we are using as an address one comma
dollar sign which means from first to last line and we will replace John with name Richard
and it is working great again again print output of our file to see clearly.
Is there if you can do some experiment.
So firstly copy it they both file
too tables sorry not.
And now we can do replacement directly in input file.
So we are using option I know out what should be printed to standard output here.
So with that option we did option I would replace men John to Richard
as an input file will be table so got text so no output is printed here.
Which is correct.
And if we show output of tables read the text we see that Richard is here instead of which on great.
Now we can do some other examples on initial table file.
So it's output using cut command
and now imagine that your boss thought due to height age of partisans whose age is a greater density
and you can hide it by three steps.
So in our substitute command we need to say X which are very much set they are more so that need to
be two numbers and first Vama will be in a strange city to 9.
Second number can be represented by digital Clouse which represents any number from 0 to 9.
Be aware that in this example I am assuming that no one will be older than 99.
Otherwise we would need to adjust I guess a little bit and I guess we can replace if it's three steps.
So even around the gray we see he didn't age four Peter who had 50.
And for Mark who has said this theory this works perfectly.
Now show again output of our testing file.
And let's say that we want to replace.
But then H.
R. with three times printed h.
So instead for printing three times h r we can use Surete times ampersand symbol
and days unperson symbol represents.
Just think that Menchie's directx and even the we see that in our food is three times splinted age are
great.
This ampersand symbol is a very helpful when you want to print something which matches require expressions
while you don't know how that string looks like.