Now we can add some functionality into our script.
So open our script and you'll see that in the case section for options Desch order a fix.
We just wrote a first album and now we didn't start any information.
A fixed parameter of a specified.
So we need to change it.
So assigned to variable FX Vol. 1 which represents that parameter fix was used by user.
And of course if user didn't specify if experimentor the value of variable freak's should be different.
So at the beginning just after use each function assign value 0 to variable fix and we can write command.
So if frigs a variable is 0 do not perform for X and if it is a one perform fix.
So now Vennochi know if fixed barometer was selected.
And we can ask if a variable fix is equal to 1.
That means if a user wants to perform fix.
And also we can ask if some file was specified otherwise we would have no file for fixing space and
tub's issues which would be Rebeck And if those conditions are true we can write to users fixing spaces
at the beginning and at the end of lines.
And now we use the knowledge from set lectures and fix space issue right now for a provided file.
So we are using set with parameter I Ridgeville change provided file and we will do substitution.
So if we find a space or stops at the end of file and those spaces and tabs can be represented by character
class blank which matches space or type and this space or up can be at the end of file numerals time.
So we need to use plus to by dollar sign representing end of line and those spaces and tabs at the end
of line literally are replaced by nothing.
So that basically means we will remove them and we also need to specify input file where changes will
be done.
So now we have fixed spaces at the end of line.
And now we need to fix that.
Also at the beginning.
So match start of line followed by any space or up represented by character class blank and doe space
or DAPs character can be present numerous time.
And this if found will be replaced by nothing.
We will just remove it and we will remove it from file represented by variable file and now when spaces
issues are fixed we can print to users message.
Dan
so what we have done for OK's user specified file name and specified also fixed parameter we have fixed
spaces and tabs at the beginning and at the end of each lines and by fixing space stop.
If you mean that door spaces and tabs that are removed.
So let's say that.
But first create some testing file
so I've put some text into this file.
First line second line third line
blah blah
something here
also something here
very good
and I love that line.
And also some interesting Glenn
and we can make some spaces and that's at the beginning or at the end of some lines
and now we can say you defile.
So let's test our script.
If I specify only file
I get no output as if we didn't right.
Any logic for that option.
But even he added fixed barometer we see message fixing spaces and that's dumb heavy really fix space
issues.
Let's open our test file to see and we see that there is no space for that.
At the beginning or at the end of each line is this fixed barometer works perfectly.
So in next lecture we can work on the feature how to display space and DAPs issues like that background.