cat aa.txt | grep 'startup' |wc-l
There is no problem when testing under the linux command line. But there is a problem with php's exec, which is very strange.
Result error:
The error message is as follows: cat: write error: Broken pipe
After a lot of effort and checking a lot of information, I finally solved it.
Add the -a option to grep and it will be ok
The grep -a option means: Process a binary file as if it were text; this is equivalent to the --binary-files=text option
It should be that the content of the cat file contains a binary stream, causing grep to not recognize it
http://www.bkjia.com/PHPjc/477649.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477649.htmlTechArticlecat aa.txt | grep startup |wc-l There is no problem when testing under the linux command line. But there is a problem with php's exec, which is very strange. The result is an error: The error message is as follows: cat: write erro...