| 1. |
What is Grep Command? |
|
Answer» Grep: The name grep stands for global regular expression printer. The term regular expression refers to the generalized search patterns that grep accepts. The grep command is the least versatile. It simply prints any line, it finds that matches the pattern. The grep command searches out the patterns globally and prints out the lines containing them. Example: grep pattern filename. Here grep searches the named file (filename) for the Pattern (pattern) and prints out the lines containing the pattern. Grep raj employee searches the file inventory for the string of characters raj. It is important to realize that grep searches for the string raj and not the word raj. By this, we mean it searches for the consecutive characters “r” , “a” , and “j” without caring whether they form a word or just part of a word. Thus, the output is as follows: Rajeev 400 Ranveer 300 deshraj 200 Each line contains the string raj. |
|