All right.
Now it's time to talk about searching and manipulation.
Now, first, let's start with the grip command, the grip command.
Search for text files for the occurrence of a given regular expression and outputs.
So it stands for New Grip OC or new regular expression OC.
All right, now let's have this command the less and we learn that using the E for list, long list
format and E for all the files, it will show us something like this, as you can see.
Now, if I want to search for the desktop, for example.
Okay, so let's clear the screen.
LS dash l e then using the pipeline as we learned previously using the grip command.
So the output of this will be considered input for this.
So grep then in double quotation or without double quotation, let's put desktop and remember this is
a case sensitive.
So as you can see it found.
The desktop.
Here it is.
Now, if I put this this small like this, it will not show anything.
But if I put it or use the dash I flag, which means ignore the case sensitive.
So it will put it.
As you can see, these capital.
Yeah, the capital or this small will do the job.
All right.
Now, by the way, man, great.
You can see that it has a lot of options.
Actually, grip is a huge topic here.
Can see that it has a lot of options, flags, whatever.
Okay, cool.
Now let's talk about it.
Smith is a powerful Stream editor.
It is also a very complex.
So we will only briefly scratch its surface here.
So for example it's clear the screen lots echo here, for example.
Hello, there I am.
Zero.
Okay.
So this will bring.
Hello there I am zero.
Now in the output.
Using the pipeline.
Then set.
And then what?
Single quotation.
Now here we will put the as slash the zero and then slash but one slash.
Okay.
So this means.
Well.
Replace the zero with one so used for replace and text manipulation.
So you can see that.
Hello there I am zero.
It was there.
Hello.
There I am.
I am zero now.
Hello there.
I am one OC.
Cool.
Now, also, we can use the cut command.
And this is a command is quite handy.
So let's clear the screen again.
Let's use the same the same sentence.
Hello there I am zero.
Okay.
So hello there I am zero.
Output this and use the cut command.
Okay, now cut.
We will use the dash f option, which is the field number we are cutting.
As you can see, the field number, it will be two, for example, or as you can see, two.
Now, follow me for now.
I know you got confused dash d which is the delimiter or for the field delimiter and the delimiter will
be the space.
So this means that cut the second.
So press enter.
I will show you so you can see that it is.
Hello there.
As you can see, I am zero and the delimiter here is space.
So which means that this is the first one.
As you can see, the delimiter.
What distinguish between these two is there's space here.
Hello, space there.
Space I space and space zero.
Okay.
So the delimiter here to distinguish between the characters or what is space and cut the second one,
which means that this is the first one.
Hello.
And this is the second one.
So if I want to have the zero, what should I edit?
Yes, you are correct.
I should edit this from two.
From number two.
I mean, two.
Five.
And you can see that.
One, two, three, four, five.
So it will cut five here.
By the way, if I have something else, for example.
Hello there.
But lest the hair or commas like these.
And what space.
It will not work because you can see there there are no space here.
But what it has listed here like this and press enter it will give the same result because this is the
first one, the second, third, fourth and fifth.
So far so good.
Now finally, we will have the Swk utility, and it actually is a programming language designed for
text processing and is typically used as data extraction and reporting tool.
So for example, let's have this eco.
Who am I, for example?
And then the output.
Let's use a w k and then we will use single quotation inside it.
We open presses and then we print.
Shift then assign or shift four.
Which means dollar sign one.
And.
But let's to here.
De la sign two or three or two.
Let's have.
So this will show us something like this.
Who am I?
So this is where?
The first one.
The second one.
And here is the third one.
So if I want to print, for example, three here like this, it will print the I only.
So one, two, three.
By the way, the book is a huge topic again, but we barely scratched the surface here.
I'm just giving you a high level understanding of the tool or the or this language.
Also we have the head command.
So for example.
Let's get the result file here.
For example, the one we have previously or the test.
Let's see what inside it.
You can see the test.
It has that desktop document downloads, whatever.
Now we can use the hit command.
By the way, man hit it will print the first number of files or part of files.
So clear the screen.
Hit test the text.
You can see it will hit or print the first ten lines of the test to test because it is already have
I think it is ten lines.
So let's hit dash five here with the Dash five option.
It will print the first five lines.
As you can see.
One, two, three, four, five only.
And again, we have the tail command dash five as well.
Test the text and this will print the the last five lines of the file.
Okay, cool.
So far, so good.
By the way, we can hit.
The first lines and we can take the first two lines, which is music and pictures.
So it will be like this and tell dash to.
Like this.
It will show us this will give us the first five lines and tell us two, which is the last two files.
All right, cool.