How to invert a grep expression

grep, linux, regex

Solution

Use command-line option `-v` or `--invert-match`,

ls -R |grep -v -E .*[\.exe]$\|.*[\.html]$

Problem

The following grep expression successfully lists all the .exe and .html files in the current directory and sub directories. ``` ls -R |grep -E .*[\.exe]$\|.*[\.html]$ ``` How do I invert this result to list those that aren't a .html or .exe instead. (That is, `!=`.)

Original source