Pipes, Grep, Sort – Linux Tutorial 9
Welcome to the tutorial video on Linux Pipes gre [p] and sort order If you are new to Linux, you may wonder about the role that the pipes play and run the operating system While it is not the real pipe that you have in mind The symBol tube indicates the tube and the linux If you want to use two or more commands at the same time and run them straight you can use the pipes Pipes, enables UNIX or Linux users to create powerful commands that can perform complex tasks in Jiffy? Let us understand this with an example When you use the cat command To view the file Such as the fruits that are here and contain a lot of pages Quickly moves to the last page of the file And you do not see content in the middle to avoid this, you can direct the output of the cat command To lower it will only show you once the call lengths of the content at one time This way you can pass the file content using the arrow keys And Once you reach the end of the file has a cue to exit Instead of less you can also use PG and more commands You can view the file in Digestible bit units and scroll down once the input key is pressed once You can reach the end of the file and you can press the ENTER key again You will see this command prompt about reading the file What if you had to search for a file for text or a piece of information? For this we need to use the gre key command With this command, you can scan and reverse the document, and you can customize your search results the way you want The syntax for this is gre p space, the power of research allows us to see it in action These are the contents of the file Now we'll use the gre p command to search for avocados The syntax for this will be the cat space file name Space tube Then the gre P command followed by the string we want to [search] which will be avocados in this case Hit enter the fruit fruits of the avocado series Let's also use the same command to search for melons This is the way to find the required power in the file? You can [use] the following options using the Gi Ep command So if you want to display fonts that do not match the search Power You can use the V-option with the GI command Let's try some of them on the station here.
We will try the first option with gram.
Order ep Option I filters the string from all lines in the fire.
That is why we will get this result The sort order comes in handy when you try to insert the contents of a file Alphabetically the syntax for this command is the space space name We say we want to sort the same content as the fruits of the file? Alphabetically now.
We see that the name of all fruits is mixed Using the Sort command, we will easily be able to do this in a blink You can use the following extensions to sort order and get different results So if you want to reverse the sort order The contents of a file can use the Y-Hyphen option.
Let's try it and see how it works Using reverse sorting we have changed the alphabetical order of the contents of the fruit file Is now understand.
What are our filters? A filter is the output of the first command which becomes input for the second When the pipe is directed to commands, the filtered output of the first command is given to the following command? Let us understand this with the help of an example.
We will use the same file again for this example now We want to highlight only lines that do not contain the letter a in lowercase letters You will do it that way This is how we can filter out the first command and use it as an input to the second part Now [Ma] [if] we want this result in reverse order? We will need to run this or something like that Here the cat command will display the contents of the file The result will be output to the [P] command, which will not search for the strengths that contain the letter A.
The output of this command is then run by the Sort command Returns the result in the opposite order This is how we can use filters Summarizing what we learned today The pipes help combine two or more things The filter in the tube is output to one order serves as input to the next The gre P command can be used to search for strengths and values in a text document A sort order that sorts the content of a file PG is used less alphabetically and more commands to split a long file into readable bit units Thanks for watching I'll see you in the next tutorial.