Since there is no file called of and India therefore the grep command displays the message:Īnd then it proceeds to search the file players for the pattern son. Means here, son would be expected as a character pattern and of, India and players are expected as a file to be searched. Now watch carefully the execution of the following grep command : Here if you don’t use double quote signs then the spaces between son, of and India would not produce correct result. If we want to search for “son of India “, we write the grep command as: Sachin Tendulkar is one of the great player of all times If we want to search word great then we do as: It is our good luck we are still watching Sachin playing for India. Sachin Tendulkar is one of the great player of all times. That it is difficult to select which of them are great. First the contents of the file are:Ĭricket is the most loving game in India. For instance, let us suppose, we are going to find every occurrence of word great in the file players. Let us search a particular char_pattern in a single file. If the char pattern does not exist in the specified file then the grep command simply displays a new prompt. If you specify more than one file then each line is also immediately preceded name of the file. The grep command is used to search more than one file for particular bit pattern globally and displays the line containing them, The syntax is:Īfter the execution of this command, each line of each file that contain the specific char_pattern will be displayed on the display monitor. The name grep stands for global regular expression printer. Introduction to grep, egrep and fgrep In Unix
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |