Placeholder Image

字幕表 動画を再生する

  • Hey, guys, what's up?

  • Welcome to experience Tech.

  • My name is Vineet and in today's video will check out one of the most useful and extremely powerful command off Lennox.

  • That is the great command.

  • Now, this video was requested by one off the subscribers off experience Tec Channel, who goes by his YouTube named Dr Spiff 44.

  • Now he wanted me to do a video on some off the most powerful Lennox Command one off, which is the great command.

  • So there you go, buddy.

  • I hope this video will be useful to you.

  • And by the end of this video, you should be comfortable with this command.

  • No grip is a very flexible command with tons off options.

  • And if I try to cover it in one video, I'll either not be able to complete all the options available, or this video will become very, very Lindy.

  • And we do not want either off that.

  • Hence, I have decided to cover this command in two videos.

  • In part one, Vivid learned the syntax off grip along with all the options available, basically will cover the Turi in part one, and then in part two will do a live demo showing how to use all these options in a lively next machine.

  • All right, so let's begin Part one off grab tutorial.

  • Theo Theo stands for global regular expression Print.

  • It was developed by Ken Thompson Inverse Force, introduced in UNIX Version four operating system, released in 1974.

  • It has evolved a lot over the years, with many modifications and adaptation.

  • Now there's also a new version off crap, which comes by different in almost all distributions off the nooks.

  • And that is what we are going to cover in this video grab is a command line tool for searching plain text data set for matching search, text or pattern.

  • Now let's understand how it works.

  • No Grab takes a line from the input file, and it copies it into a buffer.

  • It then compares it against the search string, and if the comparison passes, it prints the line to the screen.

  • Not will repeat the process till the end of the fight.

  • No important thing to note here is grab does not store lines or changes line or search only a part of life.

  • Now let's look at the journals and tanks off using Grab So why let the terminal you type grab G R E p give a space and then you give one or more off the available options again a space And then in single court, you give these search text or search string again a space and then you give the input file.

  • So this is the generals in tax.

  • Now, As you can see, there are actually three mean para mito.

  • First is the input and then you have source text or sores string and third, you have options.

  • Now let's take them one by one.

  • First up is the input.

  • Now you can provide falling types off input to grab.

  • First is a text file.

  • It could be your program c++ program your python program.

  • You can also give directories that contains files or subdirectories in them.

  • You can also get input to Graham from standard in.

  • For example, you can provide an output off one command and pipe it through grab.

  • You can also give sockets as an input or devices, so these are the types off input that grip understand.

  • Second perimeter is a search text.

  • Now they should always be enclosed in single court nowthe source.

  • tanks could be one of the falling.

  • First, it could be a normal strength, like America or Apple.

  • Second, it could be a regular expression.

  • No, A regular expression are strings containing special characters, which have special meaning assigned to them.

  • Now a regular expression consists off one or more off the falling special characters.

  • First is the backslash.

  • Backslash is used to cancel out the special meaning off the next character.

  • For example, if I use backslash and a dart, no, it will not have the special meaning that a dart has in a grip command.

  • It will be used as a period sign.

  • Second is thes square brackets.

  • Square brackets contains list off characters and grip matches.

  • Any directors indeed list.

  • For example, if a give a skirt string as E and then in square brackets and give ABC grip will match any word that contains a A B or a C.

  • All right.

  • Next is the square brackets, beginning with a carrot symbol or an up arrow symbol.

  • Now here also, you can give list off directors, but grateful match any corrector that is not in the list.

  • For example, again, if I give E and then in square brackets along with a camera symbol.

  • If I give ABC Grateful Match anything but a A B A C.

  • Next up is the hyphen symbol.

  • No, this will indicate the range off characters.

  • Now, instead of giving a B C D E F G, you can just give air Dash G and Grateful Match any correct er's within that range.

  • Next is the carrot symbol.

  • No carried symbol is used to match the character at the beginning off a file.

  • For example, if I give Carrot E, it will match all those lines, which begin with character.

  • A.

  • Next is the dollar symbol.

  • It is similar to Deke ARNDT symbol.

  • It is used to match a character at the end of the line, or it.

  • Next is the period or don't symbol.

  • This will match any single character except the end of the lane.

  • Next, you have the star symbol, which matches zero or more off the preceding characters.

  • For example, if I give a and then a star reptile match, any word that contains E or e or e so on.

  • No.

  • Apart from these special character, there are also falling character classes that are available and that can be a part off a regular expression.

  • These are pretty self explanatory, but just for the sake off completion, let's go through them quickly.

  • Now correctly.

  • Classes are always enclosed in to square brackets along with a colon.

  • So, for example, you have character class lower that will include all the lower case alphabet from A to zed.

  • Similarly, you have character class upper that will match any upper case alphabet from a to zed.

  • Now you also have a corrector class.

  • All fun and art will include both lower as well as a perk actor classes.

  • Then you have character class digit Now.

  • This includes all digits from 0 to 9.

  • You also have a character class alum that is for alphanumeric that will include the Alfa character class, plus the digit character class.

  • Third is the extended regular expression or E.

  • R.

  • E.

  • Now, whenever we use an extended regular expression, we specify it by using Dash e option.

  • No extended regular expression contained one or more off the falling special characters.

  • First is the caution mark symbol.

  • Not this.

  • Indicate that the preceding item is optional and will be matched at most one next up is the plus symbol.

  • Not.

  • This indicates that the preceding item will be matched one or more time.

  • Then you have curly braces with a number in it, see and know this will indicate that the proceeding character will be managed at most end times.

  • Next is the curly braces with a number end and a comma.

  • That means that the preceding character will be matched and or more time than you have curly braces, with a number followed by comma and then another number.

  • That means that the preceding character will be matched at least anytime, but not more than M times.

  • Next up is the curly braces with a coma and then a number cm in it.

  • That means that the preceding character will be matched at most M times.

  • The so these are the special characters that make our extended regular expression.

  • Don't forget to use Dash E option whenever you're using an extended regular expression.

  • No, let's go to the third power meter.

  • That is the options.

  • There are several options available in grip now for the sake off understanding, let's divide them into three main categories.

  • First, the options available for input, then options for controlling search pattern.

  • And third, you have the options for controlling the output.

  • First is the options for controlling input.

  • Input can be.

  • As I said, it can be a text file or it could be a directory.

  • Now, if you want to search the directory recursive Lee, you have the dash lower case.

  • Our option that will.

  • So should the directory that you have provided, and also the subdirectories in that directories recursive lee and give you the output that is the most frequently used option for the input Now.

  • Next is the option for controlling the search pattern.

  • Now here you have the following options.

  • First is the dash lower Keys E that you can give to provide multiple search text or multiple source strings.

  • For example, you can give Dash E and then in court chicken type ABC.

  • Again.

  • You can give Dash E and in court you can pry provide 123 No grateful search for any line that contains either 123 or ABC, so it's kind of like our logical or operator.

  • Next, you have dash capital G.

  • No, this is by default.

  • It tells Grab that search text is a basic regular expression.

  • Next is the dash capital E option that is used for specifying extended regular expression.

  • Then you have dash capital F option.

  • This is used when you want to use special characters as a normal search tanks.

  • Then you have dash lower case I, which tells to ignore the case.

  • Then you have dash lower kiss F option to give a file as a search pattern.

  • No, no.

  • Here you can give a text file to Graham here.

  • The graft will take the first line off the search file and matches it with the entire input file.

  • And then it will go to the next line off the file provided that the search tanks next is the dash lower keys V option which is for involved match on this will invite whatever the text reapplied.

  • No dash lower case W is to check for the whole world.

  • It will only give the output where this search text is the whole world.

  • Then you have dash lower case X which will give the output for whole line.

  • So if the search text is the whole line in the input file, then it will show the results.

  • Else it will Not that these are the options for controlling search pattern.

  • No, last we have the option for controlling output.

  • Now again, there are several options in this.

  • First up is the general output control.

  • Here we have the falling options.

  • Dash Lorca's see now this will give us the number off matching lines.

  • Then you have dash capital l That will give the name's off those files that did not imagine or sores tanks.

  • Then we have dash lower kiss L.

  • This will give the names off those finds that matches our search text.

  • Then you have dash lower case M option, followed by a number this will tell.

  • Grab to stop reading the file after a particle number off matching lines, then you have dash lower case O option.

  • It will give the output as the matched part off the lines, not the complete line.

  • Then you have dash Lorca's que option.

  • That was tell not to give any output on the standard out.

  • So these were the journal output control.

  • Then you have option to control the non matching lines or contacts line that you have three option in it.

  • First is dash a followed by number.

  • It will tell.

  • Grab to print that number off trailing lines from the matched searched act.

  • Then you have dash capital be followed by a number that will tell Grab toe, print that number off leading lines and then you have a dash capital C, followed by a number that will tell Grab toe print that number off leading as well as trailing lines.

  • And at last you have the option to control the output line.

  • First is dash lower keys beat.

  • That will give you the bite off, set off matched pattern.

  • Then you have dash capital edge that will print the file name in case there are multiple files.

  • It repent the filing along with the output.

  • And then you have Dash Lorca's Etch that is used to make sure that the file name is not printed in the output.

  • And then you have dash an option, which will print the line number starting from one.

  • It will print the line number where the match occurs.

  • All right, so here, part one ends.

  • Thank you guys for watching this video.

  • I know this was a lot of fury, and some options may not be crystal fear too many off you.

  • But don't worry.

  • In the next tutorial will do a live demo on all the options that were discussed in this video.

  • If you like this video, kindly present like Britain.

  • If you have any comment, a suggestion, please Time that in the comment box and do not forget to subscribe to this channel.

  • If you want to see more such videos, Thank you guys, and I'll see you next time.

Hey, guys, what's up?

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

B1 中級

GREP COMMAND: IN-DEPTH GUIDE [ PART 1 ] (GREP COMMAND : IN-DEPTH GUIDE [ PART 1 ])

  • 4 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語