
December 11th, 2012, 10:25 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
You can't see me but I have egg on my face. So I may have aliased grep to egrep a long time ago, which would explain why the "master|worker" I searched for today worked. And why I thought that grep worked with the more powerful regular expressions by default and not the ones where | is a simple character and \| is the metacharacter.
Which leaves me with nothing to explain why it doesn't seem to work for you. Particularly when I try it myself.
Code:
$ cat test.txt
foo
bar
baz
$ cat test.php
<?php
system("grep 'foo\|bar' test.txt");
$ php -f test.php
foo
bar
$
|