utility
grep
Select matching lines. -F literal, -E extended regex. GNU status 0 match, 1 no match, normally 2 error; -q can mask errors.
Formal Syntax & Structure
bash syntaxbash
grep [-F|-E] -e PATTERN [FILE ...]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| PATTERN | string | Fixed string or regular expression. |
| FILE | path | Input; stdin when omitted. |
Return Value
exit status
0 match; 1 no match; GNU grep normally 2 on error.
Working Example
Example Snippetbash
printf '%s\n' 'a.b' 'axb' 'a-b' | grep -F -e 'a.b'