Commands
grep
grep
is a useful command to search text in a file.
Format:grep [–bcEFilnqsvx] [–e pattern] ... [–f patternfile] ... [pattern] [file ...]
grep
with multiple strings:/logs/xxx | grep -e 'error' -e 'falure'
grep
with highlight color:egrep --color=auto -i '(error|fatal|warn|drop)' /logs/xxx
Change grep
display color: following will set background to red and foreground to white:export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;37;41'
Useful links:
Writing shell scripts
Search a file for a specified pattern