#10 Mastering the grep Command in Linux: Find Anything, Anywhere - [English]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone welcome back and in today's video we are going to learn about grab command so basically grab command is a text utility it is used for searching text within a file okay so we can search the text within the file or across the files how many times it has been repeated over the file or the number of files okay let's get started with that thing okay so before proceeding forward I just wanted to tell you that I have created two new files that is file new and let me read the content for that one so that is the first file would be NN and the second would be new okay so these are the two files that we would be referencing for this video let me clear the screen okay and for now now let's see that you want to search for the word Unix and you want to ignore the case sensitivity we make use of graph hyphen I to ignore the case sensitivity and the word that you want to search that is unique and the file that you want to search for so it is new press enter it will highlight The Words which are there okay now let's see you just want to see so in a single line how many times the term Unix has been used right so we make use of graph hyphen C for the account followed by the word and that is UNIX and followed by the file name you enter it is saying me that the number is 2 which means the two times it has been repeated so this is the line one in which Unix has been written here why it didn't it didn't choose because we didn't made the choice hyphen I write because we explicitly told we want lowercase units and this is the second line in which we were searching Unix okay clear it now let's say that you want to see you are aware of there are particular files present over your system but you are not sure where in which that particular word will recite right so that for that particular thing we are going to make is of hyphen l so grab hyphen L followed by the word that you are searching for and that would be unique okay and say you don't know the file name you just press star over here and press enter it will show you the file name so new and NN are the files in which Unix term resides okay now let us do cat for new and let us do cat for NF you can see Unix is present in both of them all right let's clear it let us say that you want to search for the word Unix once again graph hyphen W and followed by the word Unix for finally okay it will only print the lines in which that particular thing has been there okay all right moving forward now you want to see the number of lines the line number in which that particular term resides for that we are going to make use of graph hyphen and followed by the uh followed by the vertex you are searching for and we finally me so in line number two and line number five that particular term resides all right okay clear it now let us see you want to see the remaining lines in which that particular term doesn't resides that can also be done wrap hyphen B orrow followed by the term that you are not looking for and the term the file link enter so these are the lines in which that particular term doesn't recite okay all right clear it there is another thing that I would like to introduce you grab iPhone okay followed by the word and the final okay it will only display the term that you are searching for okay it will not display the line number or the remaining text okay all right now let's say that you want to search when was the first time Unix was printed on a particular line okay you'll make use of graph followed by the uh followed by the word that you are searching for and the finally the only thing that you have to add is the carrot sign and that would be shift six enter okay this was the first time where the term Unix resides and this thing is known as a carrot sign all right so that was all about grab command Okay so these are the basic uh commands and the attributes that you would be using in daily life okay hence but there are many attributes that you can go for you can just refer the man manual pages enter so there are different attributes that you can go for different options that they have given okay however the things that I've told you are something which has been used uh for buyers daily right so if you want to search about text you can definitely go for crap command all right thank you for watching this video and see you in another one thank you and have a great day bye
Info
Channel: Shubham gour
Views: 91
Rating: undefined out of 5
Keywords: shubham, gour, theshubhamgour, devops, cloud, Linux, CommandLine, GrepCommand, TextSearch, TextExtraction, PatternMatching, Filtering, ProgrammingTips, CodeTips, LinuxCommands, LinuxTutorial, TechTutorial, TechEducation, OnlineLearning, ITSkills, CodingTips, CodingTutorial, LinuxSkills, LinuxCommunity, OpenSource, FreeSoftware
Id: D7Pm8SEez4E
Channel Id: undefined
Length: 4min 52sec (292 seconds)
Published: Tue Mar 28 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.