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 found an output will be something like this:
/home/00_Notes/Remarks01.txt:vanity baseline
Cheers..hope it helps. till next time.
================================
Free Android Apps:
Click on links below to find out more:
Linux Android App cheat sheet:
Multiplication Table for early learners
Catholic Rosary Guide for Android:
http://quickbytesstuff.blogspot.sg/2014/09/how-to-recite-rosary.html
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Divine Mercy Chaplet Guide (A Powerful prayer):
Comments
Post a Comment