The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help Required: Command to find IP address and command executed of a user loggedout Security 2 4 Weeks Ago 05:12 PM
Little bit weired : Find files in UNIX w/o using find or where command jatin.jain Shell Programming and Scripting 10 09-19-2007 03:47 AM
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 5 10-25-2006 02:39 PM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 02:38 PM
how to find a file in UNIX without find command? bluo Shell Programming and Scripting 3 09-24-2003 08:47 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-05-2002
Registered User
 

Join Date: Feb 2002
Location: PARIS (FRANCE)
Posts: 22
Question Using find command

Hy,
Does someone know how to setup "find" command allowing to find all files or directories according to a specific filter whatever case sensitive (I'm working on AIX platform 4.3.3).
Example:
find / -type d -exec grep ....
Or perhaps using regular expresssion
find / -type d -name *...$name...\*

Thanks for your help
Forum Sponsor
  #2 (permalink)  
Old 02-05-2002
thehoghunter
Guest
 

Posts: n/a
Do a search on www.unix.com - search for find case sensitive. Livinfree and others seem to have answered this type of question before.

If that doesn't help, respond to this again.
  #3 (permalink)  
Old 02-06-2002
Registered User
 

Join Date: Feb 2002
Location: PARIS (FRANCE)
Posts: 22
Thanks for this suggestion but i've found nothing that i've not yet be done ...
In fact, i'm searching for a substitute of "-iname" option. I'd like to use a loop using a variable ($var for example) which should be passed to search command like "find":
Ex.:
for var in listing_var
do
find . -name $var ... ...
done

I've thought about syntax like :
find . -type d -name *[A-z][$var] ...
or
find . -type d -exec grep -i $var
But i've some problem to implement it.
  #4 (permalink)  
Old 02-06-2002
thehoghunter
Guest
 

Posts: n/a
Does $ find . -print | grep -i $1 take care of it?
  #5 (permalink)  
Old 02-06-2002
Registered User
 

Join Date: Feb 2002
Location: PARIS (FRANCE)
Posts: 22
This method filters entirely the path of your search. Ex.:
find . -type d | grep -i toto
will show all directories and sub-directories containing "toto" in their paths like:
./toto
./test/ToTo
./toto/test (<- My PB !)
  #6 (permalink)  
Old 02-06-2002
thehoghunter
Guest
 

Posts: n/a
I'm not sure if you now have what you need or are looking for something else.

Original problem stated:
setup "find" command allowing to find all files or directories according to a specific filter whatever case sensitive


The suggested fix will do that.

To add it to your script would be simple.

If you need more than that, respond with more information.
If you are looking to filter more out of the output from the find comand (piped to grep) you may need to be more specific in what you are greping for (add another grep with -v option to get rid of what you don't want?)
  #7 (permalink)  
Old 02-06-2002
Registered User
 

Join Date: Feb 2002
Location: PARIS (FRANCE)
Posts: 22
Thank to be indulgent about my english ...
Yours suggestions and remarks are correct and i noticed that precisions miss so:

My complete problem is that i'm trying to set up a method (using find command for example) to filter all directories and sub-directories containing a predefined substring (like "toto") declared in a variable (because of a loop. see above for details).

I try first to implement find command with "-exec" option and combine it with grep command:
find . -type d -exec grep ... ... {} \;
But it seems not to be the good way.

...

While writting this reply, i thought about another way of solution. Perhaps have you any suggestions to improve and validate it:

find . -type d -exec basename {} \; -ls | grep -i "toto" | nawk '{print 11}'
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




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


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

Content Relevant URLs by vBSEO 3.2.0