Linux - Pipes and filters
Show More Show Less View Video Transcript
0:00
so here in this video we are going to
0:02
check with your Linux pipes and filters
0:04
which much useful when you will be using
0:07
a shell scripting programming or when
0:09
you will be configuring your own scripts
0:11
and creating your own programs so this
0:14
pipes and filters are very important for
0:16
you so let us talk about what are pipes
0:19
pipes are generally used for connecting
0:22
to different commands or we can connect
0:25
to different commands by taking the
0:27
output of your first command and moving
0:29
it to into the second command so
0:32
basically what it does know for clear
0:34
example I have a command where I want
0:36
the output now for example I have
0:38
provided two plus two I want the output
0:40
as a four this four I want to add with
0:43
this some other particular number like
0:45
plus three so the output of the first
0:48
command should be taken to this second
0:50
command so for that for merging for
0:52
those of the files will be using a pipe
0:55
command so I can see I have mentioned
0:57
over here pipe is a form of redirection
1:00
that is transfer of a standard output
1:02
provided by first command to the other
1:05
destination or on the particular command
1:08
same way that is again used by your next
1:11
shell scripting which we have already
1:13
discussed and also this commands can be
1:15
used into any of the processes or any of
1:18
the process performed by any of your
1:21
services which we have created to any
1:24
other particular service now for example
1:26
you have installed a particular software
1:29
into your Linux operating system and for
1:32
running a file first this particular
1:34
software should be enabled and installed
1:36
into the machine if it is enabled or
1:38
installed then only you will be able to
1:40
open that file which has the format of
1:43
this particular application so this is
1:45
again a pipe so Mills we are going to
1:48
standardize or sort this particular
1:50
content in such a way that the very
1:52
first dependent task is performed first
1:54
then the output is given to this second
1:57
command so that it can perform ahead
1:59
that is your pipe now again I'm talking
2:02
about the filters now pipe combines the
2:05
multiple output of your commands write
2:07
or provide one out output of the command
2:10
to the other particular process or any
2:12
the leader but filters filters works
2:15
completely in different way filters what
2:18
it will do if you have a huge firm it
2:20
can filter out the data with general you
2:23
require so what the data is required
2:25
will be again filtered by using the
2:28
commands of the filter so you have many
2:30
tools for filtering your particular data
2:32
or a particular file content you have
2:35
the commands such as your or command C
2:37
command spell command and your WC
2:40
commands now we have already used a WC
2:42
you come on you might have seen about it
2:44
you might have understood it whenever we
2:47
have a file of a huge letters and words
2:51
Inc and built into it or we have a sign
2:53
into it but it can count the number of
2:56
letters it can count the number of words
2:58
where we have encountered it manually so
3:00
automatically what it does it provides
3:02
you a filter to contain what you require
3:05
you can also search for a content that
3:07
again will be provided into the filter
3:09
commands so let us see some of the
3:11
filter commands which be used basically
3:13
into your shell scripting the commands
3:16
are sort now for example if I want to
3:19
sort multiple data multiple lines or
3:22
multiple columns I can use this card
3:25
come on saying before filtering we can
3:27
also use the PG commands so see how this
3:32
particular PG and sort commands can be
3:34
used into our Linux operating system
3:36
using different parameters so let us
3:39
begin with our terminal so here I have
3:41
two different files contain fruits names
3:45
as well as one contain the numbers now
3:48
let us check what exactly we do have
3:50
into this first now if I am moving into
3:52
the fruit I have some list of the fruit
3:55
names same thing if I'm using and
3:59
looking at your numbers I have some
4:02
numbers so let us see how we can use our
4:05
sort tools for it now starting with your
4:08
fruit names so as we know they have
4:10
multiple fruits over here and they are
4:14
not aligned in any of your ascending or
4:16
descending order and I want you know to
4:19
align it firm to align it properly so
4:22
while we are aligning it so we will be
4:24
using the command called
4:26
sorter so till align it properly
4:30
but you can see there is again a
4:32
particular fruit name that is evidence
4:35
again repeated and the small kids is you
4:40
know having the first priority and the
4:42
second list is your capital e now if I
4:46
want only these are yours the same I
4:47
want that if you know capital should
4:49
have thee first in the list or it should
4:52
appear first in the list
4:53
I'll give the command - f and then the
4:56
same fruit me re following so I can see
5:00
all the particular you know those
5:03
particular fruits like your FL and
5:06
mingle so they are having now not
5:09
inverse order the capital is you know
5:11
and first in the list and in the smaller
5:13
case is in second list same way or we
5:17
can also sort your numbers but if I'm
5:20
using these sort numbers form so it
5:25
won't sort it further because while you
5:27
are using the sort number you need to
5:28
define we are going to sort the numbers
5:30
here so according to numbers I'm going
5:33
to sort now and again see it isn't
5:35
sorting orders right so lowest to the
5:38
highest number same Li if I want to make
5:40
it reverse I can also use - our numbers
5:45
fancy it isn't print order same thing I
5:50
can also use - our for my command
5:56
it's like your sort - n R and then the
6:02
numbers so it is completely numbers
6:06
because last time I haven't defined n so
6:08
it isn't recognized this is the number
6:10
or not same way I can also sort my fruit
6:13
name in divorce over by giving - R so it
6:19
isn't reverse order so these are the
6:21
sort commands and relieve each we have
6:23
so this is how generally we use the sort
6:25
commands now I'm talking about the pipes
6:27
generally most of the times it happens
6:29
like you know we are using different
6:30
parameters like in salt we have used and
6:32
XF this are the parameter assists we are
6:35
processing your value into it simply
6:37
have seen like into these
6:40
we are passing some parameters we are
6:42
passing this value into this fellow so
6:43
that it gets me the details of the
6:45
current value same here we can use many
6:48
of the commands for you know there we
6:51
use the pipes over here and you know
6:53
filters to get access to thee anybody
6:56
compare D so here we have the filtered
6:58
value late we have no change the
7:00
sequence of the numbers we have change
7:02
the sequence of your complete orders of
7:05
the you know numbers as well as your
7:07
fruit names so this is how to really use
7:10
pipes and filters into your Linux
7:12
operating systems into next video I'm
7:13
coming up with more of the commands so
7:16
keep watching
#Programming

