Friday, September 16, 2011

find command complex pattern exclusion

For complex expression you need to include the pattern inside the brackets \( and \)

For example:

find /home/karthik  -name "*.pl" -o -name "*.pm" -o ! \( -name "*.*" -o -type d \)

1)include the files ending with .pl and .pm

1)exclude the files ending with any other pattern  than the specified "pl" and "pm".
2) to exclude the directories