dev dev dev dev - 1 year ago 167
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download