Search a string or a pattern in text files without opening the file. Grep is a handy tool to find or search a string in text files. Grep is an available tool in Linux and Unix OSes. So if you have some data or information stored in text files and forget where the file is located. As long as you know the keyword or a string to search for, then grep and find command will be your utmost friend. "Grep" and "find" are tools to make life easier to get the information you want but how to use it? Command below will search recursively in the patch specified for all the text files and display the file where the match is found, output will also include the path and the filename. find /home/00_Notes -name '*.txt' -print0 | xargs -0r grep -H 'vanity baseline' The xargs -0r, is zero r. The above command will search recursively in all folders and subfolders for text files which contains the string "vanity baseline". If a match is ...
Make the world a better place by sharing knowledge, ideas and anything that you can give that comes from the heart.