1
00:00:04,270 --> 00:00:10,660
In the previous lecture, I have demonstrated you how to use exact option in find command, and using

2
00:00:10,660 --> 00:00:14,740
such option you could redirect a result of find command.

3
00:00:14,770 --> 00:00:22,570
It is actually a list of files and folders to specific Azure command like or cut, but it's also possible

4
00:00:22,570 --> 00:00:30,700
to redirect result of find command via stdout to stdin of another process using pipe operator.

5
00:00:30,970 --> 00:00:37,180
But before talking about that, let me explain you what is xz command and let me show you following

6
00:00:37,180 --> 00:00:37,840
example.

7
00:00:37,840 --> 00:00:40,960
Let me type ls pipe cut.

8
00:00:41,440 --> 00:00:44,650
How do you think what we will see here in this output?

9
00:00:45,330 --> 00:00:51,580
Let's press enter and see actually list of files located in current directory.

10
00:00:51,600 --> 00:00:53,400
It is home directory for root user.

11
00:00:54,140 --> 00:00:55,310
What happens here.

12
00:00:55,850 --> 00:01:02,840
Here is result that is produced by STD out of LHS process and using pipe operator.

13
00:01:02,840 --> 00:01:09,050
We send this result via STD out to STD in of cut command.

14
00:01:10,020 --> 00:01:17,220
And when you do so, cut will simply print results received from STD in to its STD out.

15
00:01:17,250 --> 00:01:18,030
That's all.

16
00:01:18,420 --> 00:01:22,200
That's why here we simply see list of files.

17
00:01:23,010 --> 00:01:23,580
But now.

18
00:01:23,580 --> 00:01:32,160
Question What if you want to read contents of every file that was found using RLS command by Cat Command?

19
00:01:33,170 --> 00:01:36,350
In such case, you need to use cod command like this.

20
00:01:36,380 --> 00:01:36,920
Cut.

21
00:01:36,920 --> 00:01:40,940
And here will be for example, name of this file file one dot txt.

22
00:01:41,180 --> 00:01:45,050
Next will be name of second file and so on.

23
00:01:45,080 --> 00:01:48,320
Different arguments will be sent to cut command.

24
00:01:49,020 --> 00:01:56,250
But with such syntax, it's not possible because in such case cod will simply receive result of lhs

25
00:01:56,250 --> 00:01:58,470
command to its stdin.

26
00:01:59,390 --> 00:02:06,560
But if you want to send result of previous command, for example, this command as arguments for next

27
00:02:06,560 --> 00:02:11,300
command, you could use following syntax ls pipe.

28
00:02:11,330 --> 00:02:13,160
Here will be args.

29
00:02:13,190 --> 00:02:19,850
It is additional command and here will be as argument name of the process you want to send arguments

30
00:02:19,850 --> 00:02:20,300
to.

31
00:02:21,380 --> 00:02:23,840
Let's press enter and see what will happen.

32
00:02:24,290 --> 00:02:30,200
And now I see actually contents of every file that was found using command.

33
00:02:31,640 --> 00:02:40,970
And it means that now cut command has received as arguments all those files that were found by command.

34
00:02:41,240 --> 00:02:47,180
This would ask command does actually you could have a look at the help for this command.

35
00:02:47,960 --> 00:02:48,860
Does help.

36
00:02:48,860 --> 00:02:52,760
And let's scroll up to description of this command.

37
00:02:52,940 --> 00:03:02,390
And here I see following text usage ex args option command command is mandatory and afterwards initial

38
00:03:02,390 --> 00:03:03,020
args.

39
00:03:03,470 --> 00:03:11,390
It means that you supply specific command like we did with cut command as argument to ex args command.

40
00:03:12,200 --> 00:03:16,250
And in such case, you will run a specific command.

41
00:03:16,280 --> 00:03:21,200
In our example, Cod Command with some initial arguments, if any.

42
00:03:21,230 --> 00:03:25,220
You could supply initial arguments like name of other files you want to read.

43
00:03:25,800 --> 00:03:29,100
And more arguments read from input.

44
00:03:29,130 --> 00:03:32,010
Input here is meant standard input.

45
00:03:32,690 --> 00:03:36,230
And that's why here in this example, let me go back to it.

46
00:03:37,610 --> 00:03:46,490
In this example, all those files that were found by LHS command will be sent as arguments to cut command.

47
00:03:47,000 --> 00:03:51,980
You could also add here additional arguments like additional file.txt.

48
00:03:52,250 --> 00:04:00,110
In such case, arguments received from previous command via stdin will be concatenated to this argument

49
00:04:00,110 --> 00:04:04,250
and cut will be executed with multiple arguments, including this one.

50
00:04:04,900 --> 00:04:07,570
That's how Xargs command works.

51
00:04:08,110 --> 00:04:14,620
And actually, we are able to combine Xargs command, command and find command.

52
00:04:14,620 --> 00:04:15,730
And let's do that next.

53
00:04:15,730 --> 00:04:22,870
And you'll see difference between using exec option and piping to command using Xargs command as well.

54
00:04:22,990 --> 00:04:23,830
I'll see you next.

55
00:04:23,830 --> 00:04:24,400
Bye bye.

