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

NameTypeDescription
PATTERNstringFixed string or regular expression.
FILEpathInput; 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'
Bash Reference