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
Restrict FTP access to a single directory for only one user. santhoshkumar_d UNIX for Advanced & Expert Users 8 05-23-2008 08:08 AM
Question about Restricting Search path of FIND to current directory super_duper_guy UNIX for Dummies Questions & Answers 2 10-17-2005 09:10 AM
Command to recursivly search all html files below the current inane Shell Programming and Scripting 3 11-22-2004 05:23 AM
Using tar for current directory, but not subs beilstwh UNIX for Dummies Questions & Answers 3 09-13-2004 09:33 AM
Restrict users to ther home directory alfabetman UNIX for Dummies Questions & Answers 1 10-04-2001 02:31 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-28-2007
sachin.gangadha sachin.gangadha is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 37
Restrict my search to current directory.

Hi every1,

There is a folder with .lst files which has email id's of our project group.
I want to find files which has my email id starting with sachin but i dont want find command to search subdirectories. I have read about prune but i didnt understand that. I am pretty new in this field. Please help.
  #2 (permalink)  
Old 11-28-2007
gus2000 gus2000 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 157
The "-prune" command prevents subdirectories from being opened. So it's pretty worthless to run "find . -prune" since it only returns ".". You need this:

Code:
cd /mydir/mypath
find * -prune -user root
This runs "find" against every entry in the current directory (since "*" is expanded by the shell). No subdirectories are traversed. Any files that are owned by user "root" will match and be displayed. Note that "*" does not include hidden files, and that "find *" will fail if there are too many files in the current directory.
  #3 (permalink)  
Old 11-28-2007
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 708
Hi.

Check your man find page to see if it accepts -maxdepth 1 -- that would do what you want in GNU/Linux and FreeBSD ... cheers, drl
  #4 (permalink)  
Old 11-29-2007
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
how about:
Code:
cd /path/to/dir
grep sachin *
  #5 (permalink)  
Old 11-29-2007
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,861
Quote:
Originally Posted by Yogesh Sawant View Post
how about:
Code:
cd /path/to/dir
grep sachin *
Or even:

Code:
grep 'pattern' /path/to/dir/*.lst
  #6 (permalink)  
Old 11-29-2007
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 708
Hi.

Are we looking for filenames that begin with with the string sachin or are we looking in files for the string sachin? ... cheers, drl
  #7 (permalink)  
Old 12-01-2007
JayC89 JayC89 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 50
To search file names I would use;

ls -ltra *whatever*

to search within the files I would use;

grep -i whatever *

-i basically meaning ignore case.
Closed Thread

Bookmarks

Tags
find -maxdepth, grep, linux

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 06:01 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