grep - How to search a directory/directories in unix by excluding certain file extensions -


i've tried using

find . | grep -v '(.ext1|.ext2)$' 

but still returns files ending extensions .ext1 , .ext2. tried following:

ls | grep -v ".ext1$" | grep -v ".ext2$"  

and works how want it. there way i'm looking ? want list files or directories not end in .ext1 or .ext2.

you have not escaped . try . work. remember . needs escaped.

 ls | grep -v '\.ext1$' | grep -v '\.ext2$'  

same find

find . | grep -v '(\.ext1|\.ext2)$'

hope helps :)


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -