The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Can I know find syntax to find given date files bache_gowda Shell Programming and Scripting 3 03-26-2008 06:37 AM
making a recursive find more useful.. spanish_tony UNIX for Dummies Questions & Answers 3 03-14-2007 05:48 AM
find file with date and recursive search for a text rosh0623 UNIX for Advanced & Expert Users 10 08-16-2006 02:27 PM
awk syntax question hcclnoodles Shell Programming and Scripting 2 10-28-2004 12:45 PM
Performing a non-recursive find in Unix christallott UNIX for Advanced & Expert Users 3 09-06-2002 09:13 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-18-2005
alexkav alexkav is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 11
Question: non-recursive find syntax

Hello, I am trying to search a directory for all files matching "G*" without looking in sub-directories "success" and "error". I've searched this forum and found the following syntax, but can't make it work:

find . \( ! -name success -prune -name error -prune \) -type f -name "G*"

Have consulted the man pages for find, experimenting with -depth but no luck. Please let me know what I'm doing wrong.

Thanks,
alexkav
  #2 (permalink)  
Old 02-18-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
find . \( -name success -prune \) -o \( -name error -prune \) -o -name "G*" -print
  #3 (permalink)  
Old 02-18-2005
alexkav alexkav is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 11
Perfect. Thank you!
  #4 (permalink)  
Old 02-21-2005
alexkav alexkav is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 11
help again

Hello agian, is it possible to adjust the "find" command to only find files beginning with "G" and followed by numbers?

For example:

good: G102030
bad: GFI_UPLOAD.log

Thanks,
alexkav
  #5 (permalink)  
Old 02-21-2005
alexkav alexkav is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 11
Ok, here's using grep:

find . \( -name success -prune \) -o \( -name error -prune \) -o -name "G*" -print) | grep '[0-9]\{6\}'

Thanks,
alexkav
  #6 (permalink)  
Old 03-10-2005
milhan milhan is offline
Registered User
  
 

Join Date: Oct 2002
Location: /home
Posts: 133
what if i don't know what subdirectories there are?

Quote:
Originally Posted by Perderabo
find . \( -name success -prune \) -o \( -name error -prune \) -o -name "G*" -print
what if there are a lot of subdirectories, or there are subdirectories under subdirectories(like a tree), that is, I shouldn't be specifying what subdirectories not to descend. Isn't there a way to tell find command to search for file only in the specified directory(but do not descend any subdirectory) ?
  #7 (permalink)  
Old 03-10-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Look in the faq section for the answer.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0