1 00:00:00,440 --> 00:00:06,030 ‫Of course, there are many utilities available in Linux and Unix systems that allow you to process and 2 00:00:06,030 --> 00:00:07,440 ‫filter text files. 3 00:00:08,130 --> 00:00:16,290 ‫Cut is a command line utility that allows you to cut parts of lines from specified files or piped data, 4 00:00:16,620 --> 00:00:24,930 ‫and print the result to standard output so it can be used to cut parts of a line by delimiter, byte 5 00:00:24,930 --> 00:00:26,820 ‫position and character. 6 00:00:28,140 --> 00:00:38,310 ‫Dash RF is the parameter used to select only specified fields with a dash parameter D limiters used 7 00:00:38,310 --> 00:00:39,630 ‫to cut data. 8 00:00:40,740 --> 00:00:43,020 ‫So let's see how it works. 9 00:00:44,580 --> 00:00:51,030 ‫Go to Kelly and the most common file to understand the usage of the cut command, I think, is slash 10 00:00:51,060 --> 00:00:53,400 ‫ETSI slash password. 11 00:00:54,630 --> 00:00:56,760 ‫So let's view the contents of this file again. 12 00:00:58,020 --> 00:01:06,780 ‫As you can see, each data is separated by a colon, so that means that we can use the colon as a delimiter. 13 00:01:22,380 --> 00:01:25,890 ‫Let's get the first fields of each line with the Dash F1 parameter. 14 00:01:48,530 --> 00:01:57,140 ‫OK, so this error is caused by the slash, because password is a file, not a directory, so don't 15 00:01:57,140 --> 00:01:58,820 ‫use a slash at the end of the file. 16 00:02:00,940 --> 00:02:03,040 ‫Now, let's delete it and run the command again. 17 00:02:05,530 --> 00:02:06,040 ‫OK. 18 00:02:06,070 --> 00:02:07,120 ‫See how that works. 19 00:02:07,450 --> 00:02:09,580 ‫We get the first fields of each row. 20 00:02:17,720 --> 00:02:19,610 ‫So let's change the field numbers. 21 00:02:20,300 --> 00:02:23,150 ‫You can select multiple fields just using a comma. 22 00:02:24,470 --> 00:02:28,280 ‫And sure enough, we'll get the third and fourth fields of each row in the file. 23 00:02:29,900 --> 00:02:31,840 ‫The first numbers are user IDs. 24 00:02:31,850 --> 00:02:35,150 ‫The second numbers are the group IDs of the users.