dev dev dev dev - 1 month ago 19
Linux Question

grep with star symbol

What is the difference between grep commands:

grep text* ==> does not give any result
grep text * ==> gives result


and what is different if I search text as "text".

Answer

grep requires (at least) two arguments -- what you are searching for, and where you are searching for it. If the second argument is not provided, then it will use stdin instead.

grep text* is waiting for stdin to provide it something to search through.

grep text * is searching through all the files in the current directory and returning the results.