Find command with exclusions


 
Thread Tools Search this Thread
Operating Systems Solaris Find command with exclusions
# 1  
Old 08-27-2008
Find command with exclusions

Hi All

I need to find the biggest files on our system BUT excluding some directories.

I.E Find / -size +10000 (excluding 'platform'|'db' ..etc) |sort -n > file

I tried grep -v but that can only do one expression at a time. Tried /usr/xpg4/bin/grep but cant use -v

Please help
Chris
# 2  
Old 08-27-2008
find / -size +10000c | egrep -v "platform|db" |sort -n
# 3  
Old 08-27-2008
GREAT !!! Thanks its working 100%
# 4  
Old 08-27-2008
Just a quick question whats the 'c' for ? +10000c
# 5  
Old 08-27-2008
The "c" stands for bytes (I guess originally "characters" but with Unicode and what not, that is not any longer one-to-one with bytes ... the "b" suffix is already used for "blocks" though) but isn't strictly necessary. As you might imagine, the manual page has more information.

Another approach is to use find's own options to exclude certain directories. The syntax is somewhat tricky but if you have GNU find, there is a rich set of conditions you can use to identify particular directories for inclusion or exclusion. A common trick is to select the directories you want to exclude and use -prune on them. So for example

Code:
find / -path /platform -prune -o -path /db -prune -o -size +10000 -ls

# 6  
Old 08-27-2008
Thanks era !
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String of exclusions failed.

We are in a conversion where a list of six digit numbers needs to be excluded from an existing report. As new ones are added we have an ever longer string of "grep -v" commands like: grep -v 020516 | grep -v 020522 | grep -v 030132 | \ grep -v 030330 | grep -v 030357 | grep -v 050111 | \ ... (7 Replies)
Discussion started by: wbport
7 Replies

2. Shell Programming and Scripting

Find command to find a word from list of files

I need to find a word '% Retail by State' in the folder /usr/sas/reports/RetailSalesTaxallocation. When I tried like below, -bash-4.1$ cd /usr/sas/reports/RetailSalesTaxallocation -bash-4.1$ find ./ -name % Retail by State find: paths must precede expression: Retail Usage: find ... (10 Replies)
Discussion started by: Ram Kumar_BE
10 Replies

3. Shell Programming and Scripting

Find multiple string in one file using find command

Hi, I want find multiple string in one file using find coomand. And keeping it in one variable.grep is not working. (5 Replies)
Discussion started by: vivek1489
5 Replies

4. UNIX for Advanced & Expert Users

Port redirection with exclusions

Hi folks, I have an application that is acting up. I have another machine with a replacement application on it but because of the naming structure clients are using I cannot change the name to the replacement machine as it is also used to access other applications. The host OS is Centos 5.6... (0 Replies)
Discussion started by: beddo
0 Replies

5. Shell Programming and Scripting

How to use grep & find command to find references to a particular file

Hi all , I'm new to unix I have a checked project , there exists a file called xxx.config . now my task is to find all the files in the checked out project which references to this xxx.config file. how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies

6. Shell Programming and Scripting

Find, regular expression, anyway to simplify this find command?

Hello everyone, first post here, trying to learn scripting on my own and this forum as been really helpful so far. I made few little scripts working great but I m facing some problems with RE. I have a bunch of files in many subdirectories called *001.ext *002.ext OR simple *.ext or *01.ext... (7 Replies)
Discussion started by: Sekullos
7 Replies

7. Linux

Simplified find command to find multiple file types

Hi, I'm using the following command to find the multiple requierd file types and its working fine find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies

8. UNIX for Dummies Questions & Answers

how to find a file named vijay in a directory using find command

I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem. so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies

9. Shell Programming and Scripting

Little bit weired : Find files in UNIX w/o using find or where command

Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same. Thanks in advance. Regards Jatin Jain (10 Replies)
Discussion started by: jatin.jain
10 Replies

10. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies
Login or Register to Ask a Question