[lug] grep question
tkil at scrye.com
Tue Jan 29 12:56:26 MST 2002
>>>>> "Scott" == Scott A Herod <herod at interact-tv.com> writes:
Scott> I need a grep command that returns true if either or both is
Scott> present. The grep man page suggests that you can use the infix
Scott> operator | (the pipe symbol) but I can't figure out the syntax.
Scott> Does anyone know how?
try "egrep"; i don't recall if plain grep can do alternation.
| if egrep -q 'foo|bar' $file > /dev/null 2>&1
| echo "found foo or bar"
note the "-q", a possible optimization.
More information about the LUG