grep command tutorial
What is grep? grep stands for G lobally search a R egular E xpression and P rint. Created by Ken Thompson, the author of B Programming Language. It is a command-line utility to search a particular string in the files. Usage 1: Search a particular word in file To search a particular word in a file. $ grep <word> <file to search> Eg. grep hello words.txt The above command searches for word "hello" in the file "words.txt" and prints the matching lines in which the word "hello" is present in the file . The above command by default performs case sensitive search, this means if there is "Hello" present in the words.txt file it won't be detected by the search. Usage 2: Case Insensitive word search in file $grep -i <word> <file to search> Eg: grep -i hello words.txt The above command performs case insensitive search and gives you "hello" "Hello" or other variants in the search. Usa...