Search
Showing posts with label grep. Show all posts
Showing posts with label grep. Show all posts
Wednesday, 18 April 2012
How to use the GREP command
I recently had to search for a particular string in a bunch of PHP and CGI bin files, other search methods would not have worked so grep came to the rescue!
grep command
grep “text string to search” directory-path
Examples
To search for a string called CHEESE in all text files located in /home/purpleotter/*.txt directory:
$ grep "CHEESE" /home/purpleotter/*.txt
To search all subdirectories recursively
To search for a text string in all files under directories, recursively use the -r option:
$ grep -r "CHEESE" /home/purpleotter
Thursday, 8 December 2011
Linux find iname
If you need to quickly find a file or directly but have no idea of case or path, use the following:
find -iname "somefile.txt"
Subscribe to:
Posts (Atom)