I have three file in a directory:
a.html:
<html>
a
</html>
b.html:
<html>
b
</html>
htmlfile:
this is just a html file
I want to get the files which filename extension are not .html, so the command I use is:
ls|grep -v *html
but the result is:
<html>
b
</html>
why?
Thank you. but I don’t know why ls|grep -v *html print out the content of b.html. if this command is print out the content of files which ending with .html, why don’t print out the content of a.html?
Since you did not put
*htmlin quotes, the shell expands your command toNow, since
grepis called with two arguments, it will ignore stdin. So the result is equivalent towhich prints the contents of
b.html.edit
To make it work, use either
or