Quote:
Originally Posted by dazdaz
for either string 1 or string 2 and string 3.
...
egrep '(string1|string2)string3' file
|
well that means grep for string1 or string2 followed by string3, doesn't it?
Do you mean
1. for either string 1 or (string 2 and string 3). ?
or
2. for (either string 1 or string 2) and string 3. ?
echo string1 > file
echo string2 >> file
echo string3 >> file
echo string1string3 >> file
echo string2string3 >> file
2.
egrep '(string1|string2)string3' file
string1string3
string2string3
1.
egrep '(string1|string2.*string3)' file
string1
string1string3
string2string3
What was the question again?