![]() ![]() For example to find out how many times your wp-cron file has been called then grep -c wp-cron /var/log/httpd/access_log will give you that figure. If you are not interested in the lines that match, only the number of lines that match, then -c is the option to use. Using grep -i "SeArCh" filename will find any occurrence of the term “search” no matter what the case. ![]() The -i option allows you to do case insensitive searches. For instance, if you want to view your Apache logs and exclude any googlebot lines you would use grep -v "googlebot" /var/log/httpd/access_log. To do this use grep -v “expression” filename. When running a grep match on a file you will sometimes want to exclude lines. If you are doing anything using PCRE then use grep -P "expression" filename. In this tutorial, we will cover basic and PRCRE. PCRE is the most commonly used regex and what our regex tutorial covers. The -P option enables Perl Compartible Regular Expressions also known as PCRE. These are extended, fixed, basic and Perl. There are four types of regex supported by grep. The options will be covered in each of the following sections. The main options we will use in this tutorial are -P, -v, -i, -c, -color, -L, and -l. Grep will by default display any lines in a file that contain the expression. ![]() The basic usage of the command is grep expression filename. Grep stands for Globally search a Regular Expression and Print.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |