In the previous lecture, I have demonstrated you how to use exact option in find command, and using
such option you could redirect a result of find command.
It is actually a list of files and folders to specific Azure command like or cut, but it's also possible
to redirect result of find command via stdout to stdin of another process using pipe operator.
But before talking about that, let me explain you what is xz command and let me show you following
example.
Let me type ls pipe cut.
How do you think what we will see here in this output?
Let's press enter and see actually list of files located in current directory.
It is home directory for root user.
What happens here.
Here is result that is produced by STD out of LHS process and using pipe operator.
We send this result via STD out to STD in of cut command.
And when you do so, cut will simply print results received from STD in to its STD out.
That's all.
That's why here we simply see list of files.
But now.
Question What if you want to read contents of every file that was found using RLS command by Cat Command?
In such case, you need to use cod command like this.
Cut.
And here will be for example, name of this file file one dot txt.
Next will be name of second file and so on.
Different arguments will be sent to cut command.
But with such syntax, it's not possible because in such case cod will simply receive result of lhs
command to its stdin.
But if you want to send result of previous command, for example, this command as arguments for next
command, you could use following syntax ls pipe.
Here will be args.
It is additional command and here will be as argument name of the process you want to send arguments
to.
Let's press enter and see what will happen.
And now I see actually contents of every file that was found using command.
And it means that now cut command has received as arguments all those files that were found by command.
This would ask command does actually you could have a look at the help for this command.
Does help.
And let's scroll up to description of this command.
And here I see following text usage ex args option command command is mandatory and afterwards initial
args.
It means that you supply specific command like we did with cut command as argument to ex args command.
And in such case, you will run a specific command.
In our example, Cod Command with some initial arguments, if any.
You could supply initial arguments like name of other files you want to read.
And more arguments read from input.
Input here is meant standard input.
And that's why here in this example, let me go back to it.
In this example, all those files that were found by LHS command will be sent as arguments to cut command.
You could also add here additional arguments like additional file.txt.
In such case, arguments received from previous command via stdin will be concatenated to this argument
and cut will be executed with multiple arguments, including this one.
That's how Xargs command works.
And actually, we are able to combine Xargs command, command and find command.
And let's do that next.
And you'll see difference between using exec option and piping to command using Xargs command as well.
I'll see you next.
Bye bye.