The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find cmd working in Linux and not in SunSolaris 5.8 navjotbaweja SUN Solaris 4 11-28-2007 11:21 AM
To find the RAM size for an Linux server. navojit dutta Shell Programming and Scripting 3 09-14-2007 04:49 AM
Where can I find Linux functions corresponding to the Solaris DDI? boyanov High Level Programming 3 06-28-2007 06:31 AM
How to find the help in Linux zp523444 UNIX for Dummies Questions & Answers 3 12-13-2005 04:02 PM
Command to find 32/64 bit in Linux giribt UNIX for Dummies Questions & Answers 3 08-17-2005 06:19 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-18-2008
Registered User
 

Join Date: Jun 2008
Posts: 3
Find in HP,AIX vs Linux

Hi Guys,

Wondering if anyone can help me. I have a find command on a Linux box that works as expected:

Code:
find  \( -not -type d -or -not -name log -and -not -name loc -and -not -name usr -and -not -name etc -and -not -name tmp -and -not -name wrk -and -not -name changes -or -prune \) -and -not -type d -exec ls -1 {} \;
Selects all files that are not in speified directories.

Problem is I can't get the syntax correct for HP and AIX. It seems I cannot use -not or -or.

Any suggestions would be helpful,

Cheers

Last edited by Yogesh Sawant; 06-23-2008 at 12:54 AM. Reason: added code tags
Reply With Quote
Forum Sponsor
  #2  
Old 06-19-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
GNU find has a number of extensions which are not commonly found on traditional big-iron systems. Usually, you can install GNU find on those systems (or find, to your surprise, that somebody already did, and you just needed to find it. Sorry for the bad puns). If that's not an option, perhaps the Perl find2perl utility can help you achieve what you want.
Reply With Quote
  #3  
Old 06-19-2008
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 1,031
Yup - for AIX there you go:
IBM AIX Toolbox Download Page - Alphabetical Listing
Check for "findutils".
Reply With Quote
  #4  
Old 06-19-2008
Registered User
 

Join Date: Jun 2008
Posts: 3
Thanks for the speedy response guys,

Maybe what I am trying to do needs a little more explaination. I am executing the command remotly through ssh -qT on over 200 servers so installing GNU is not an option. What I really need is examples of any find command using -prune, -not and -or (or eqivalent) on HP and AIX so I can create the commands.

Cheers
Reply With Quote
  #5  
Old 06-19-2008
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 1,031
How do you manage so many hosts? How do you handle updates? Don't you use a CSM for AIX? Else -> "man find" and good luck The rpm of gnu find should be very small so no much impact on network and boxes either.
Reply With Quote
  #6  
Old 06-20-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,262
If you are creating scripts/commands for so many different hosts you should not develop them on a Linux box. The reason is that GNU utilities have so many extra-features that getting the command to work on other UNIX dialects is usually impossible.

The "logical not" in standard "find" is the exclamation mark:

Code:
find . ! -type d
will find everything except for directories, for instance. The GNU find should understand this too.

I hope this helps.

bakunin
Reply With Quote
  #7  
Old 06-22-2008
Registered User
 

Join Date: Jun 2008
Posts: 3
Hi All,

Got it working in the end:

Code:
find . \( ! -type d -o ! -name log -a ! -name loc -a ! -name usr -a ! -name etc -a ! -name gridctrl -a ! -name tmp -a ! -name wrk -a ! -name changes -o -prune \) -a ! -type d -exec ls -1 {} \;
Thanks for all the help!!!

Last edited by Yogesh Sawant; 06-23-2008 at 12:56 AM. Reason: added code tags
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux, solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0