Skip to main content
POSIXified
Source Link
Stéphane Chazelas
  • 586.3k
  • 96
  • 1.1k
  • 1.7k

Find supports -o

find \. ! '(' -name '*.txt' -o -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you should not parse the output of ls)

ls | egrepgrep -vEv '\.(txt|pdf)$' | column 

Find supports -o

find \! '(' -name '*.txt' -o -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you should not parse the output of ls)

ls | egrep -v '\.(txt|pdf)$' | column 

Find supports -o

find . ! '(' -name '*.txt' -o -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you should not parse the output of ls)

ls | grep -Ev '\.(txt|pdf)$' | column 
add in link to Greg's wiki, thanks @jw013
Source Link
derobert
  • 113.3k
  • 20
  • 242
  • 289

Find supports -o

find \! '(' -name '*.txt' -o -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you shouldn't parse the output of lsshould not parse the output of ls)

ls | egrep -v '\.(txt|pdf)$' | column 

Find supports -o

find \! '(' -name '*.txt' -o -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you shouldn't parse the output of ls)

ls | egrep -v '\.(txt|pdf)$' | column 

Find supports -o

find \! '(' -name '*.txt' -o -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you should not parse the output of ls)

ls | egrep -v '\.(txt|pdf)$' | column 
`-o` and `-!` are more portable than `-or` and `-not`
Source Link
jw013
  • 53k
  • 11
  • 143
  • 142

Find supports -oro

find -not\! '(' -name '*.txt' -oro -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you shouldn't parse the output of ls)

ls | egrep -v '\.(txt|pdf)$' | column 

Find supports -or

find -not '(' -name '*.txt' -or -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you shouldn't parse the output of ls)

ls | egrep -v '\.(txt|pdf)$' | column 

Find supports -o

find \! '(' -name '*.txt' -o -name '*.pdf' ')' 

You need the parenthesis to make the precedence right. Find does a lot of stuff; I suggest reading through its manpage.

You can also do an or in grep (but really, you shouldn't parse the output of ls)

ls | egrep -v '\.(txt|pdf)$' | column 
Source Link
derobert
  • 113.3k
  • 20
  • 242
  • 289
Loading