I wanted to grep all the .txt files using wildcard character '*'.
I tried this command (as well as without the quotations " ") but failed.
ls | grep "*.txt"
The interesting thing is that if I put another character in the grep command corresponding to a .txt file in the directory, it works
>>ls | grep s*.txt sample.txt
I know that
ls *.txt will work but I was a bit amazed by the nature of the grep command. Could someone help me why is this happening?
Is it because of the fact that grep uses regular expressions, please help.