To use OR when you are doing a grep search use the \| characters to separate the items you are searching for.
cat text_to_search_in | grep 'first\|second\|third'
To use OR when you are doing a grep search use the \| characters to separate the items you are searching for.
cat text_to_search_in | grep 'first\|second\|third'
You would like to tail the Vault auth log files, but if you use the vault tag for auditing and your server is also named vault, you cannot filter out the vault auth logs only.
Use the client_login as the filter in grep:
ubuntu@vault1:~$ sudo tail -f /var/log/auth.log | grep 'client_token'
Problem
You would like to find the files that contain some specific text, and would like to do it recursively (ie in a project folder), using something simpler than the find command.
Solution
You can use the following in your current top folder to search recursively, case-independent and by displaying the file number that the searched text appears, with the following:
grep -rin "TextToBeSearched" .
Problem
You would like to know the processes ids for certain program/keyword etc, in linux.
Solution
Use the following to get a list of the processes ids replacing ruby with the keyword that you are looking for:
ps ax | grep ruby | awk '{print $1}'
Problem
You want to search in a directory or some files for a specific string and you also want to know the number in the file that the text is found.
Solution
Use grep with the -n for the line number and the -r for directory search as in the following:
grep -n -r 'search_item' /path/to/folder/