Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find command NOT certain files 1

Status
Not open for further replies.

kasparov

Programmer
Feb 13, 2002
203
GB
I want to run the find command to grep all files except those that end with ".log" which have a certain string in. I understand there's a -not flag in Linux but I'm on Solaris & it doesn't seem to exist there.

This works file on all files ($1 because it's in a script)

Code:
find . -type f -print -exec grep -i $1 {} \;

but I can't figure out how to omit the masses of log files which I know also have the string in. Does anyone have any suggestions?

Thanks as usual - Chris
 
[tt]find . -type f -name '*want_this*' ! -name '*.log' -print[/tt]

of course there's always the man page...

[tt]man find[/tt]


HTH,

p5wizard
 
Thank you p5wizard.

PS - I did look in the man page ... but clearly not carefully enough :-0 thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top