8:43 02/01/2015
###############
Highlighting searched patterns
You can highlight patterns easily while searching large number of files:
$ grep --color=auto -iR '<content of files>' *.conf
#
Displaying file names and line number for searched patterns
You may also need to display filenames and numbers:
$ grep --color=auto -iRnH '<content of files>' *.conf
-n : Prefix each line of output with the 1-based line number within its input file.
-H Print the file name for each match. This is the default when there is more than one file to search.
$grep --color=auto -nH 'listen' *
#
Source: http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/
#
#You can also use find command:
find . -name "*.conf" -print | xargs grep "listen"
############
#11:01 17/01/2015
cd /etc/nginx/site-availabled/
grep --color=auto -iR 'autoindex' *.conf
cd /etc/nginx_64180/site-availabled/
grep --color=auto -iR 'autoindex' *.vhost
cd /etc/nginx_64280/site-availabled/
grep --color=auto -iR 'autoindex' *.vhost
No comments:
Post a Comment