Artificial intelligent assistant

grep with special expressions I have some binaries and some `.c` extension files in my directory. Here the output using `ls` > arrays.c basic0 basic0.c fromfb fromfb.c oute oute.c segmen.c simp simp.c Here i want to filter binary files only , so I use ls |grep -v .c This command list all files, Then using `grep` I get files, except those file not ending with .c What I expect is basic0 fromfb oute simp But What i got fromfb oute simp basic0 binary file missing. What is the problem with this?

As per `man grep`

> The period . matches any single character.

thus `grep .c` match any character followed by `c`

You might be looking for `grep -v \.c` or better `grep -v '\.c$'`

where

* `\.` escape special meaning of .
* `c`
* `$` end of line (when piped to ls output one file name par line)



as suggested by wildcard, you can also use `grep -vF .c` The `-F` flag tells grep to use arg as simple string, not regular expression.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy db714aa1ce5554f6164a3c94cad37733