I have run below two commands for a very large filesgrep -E 'string1|string2' 151103*.log|grep 'string3' | grep string4awk '/string1|string2/ && /string3/ && /string4/' 151103*.logIt took almost same time for execution. But awk was much faster to show me the results which matched. grep too showed me the same result but at the end, when the process completed.Both took same time for the process to complete, just want to know the logic behind both the searches for awk and grep.Why is awk faster? Do both programs have different search logic? What if I jumble the strings in above search, does it make a difference to the search speed?
Compare awk vs. grep
awk;grep