Skip to content
Advertisement

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”.

Advertisement

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.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement