Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Avoiding 'Find' to search in subdirectories

Posted on 1997-11-10
6
Medium Priority
?
459 Views
Last Modified: 2010-04-21
I want to perform a search using the 'find' command but I don't want it to search into the subdirectories as it's defaulted to.  I'm under IRIX 6.4
0
Comment
Question by:houde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 2007670
-prune
0
 

Author Comment

by:houde
ID: 2007671
That's what I tried!
If I include it before -name, nothing returned.
If I include it after -name "pattern", I get the same result as without -prune
0
 
LVL 1

Expert Comment

by:delphinus
ID: 2007672
To find a find in the current directory, but not recurse into
subdirectories:

find . -name 'pattern' -maxdepth 1

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:houde
ID: 2007673
maxdepth is not an option of the find command under IRIX 6.4
0
 
LVL 84

Expert Comment

by:ozo
ID: 2007674
find . -print \! -name '.' -prune
0
 
LVL 1

Accepted Solution

by:
Taliesin earned 150 total points
ID: 2007675
Forget Find, and use

 ls -laF [dir] | egrep [reg_exp] | pg

or: ls [dir] | grep [simple_reg_exp]
or the short answer ("find like"):   ls -1 | grep [sub_string]

   if you still want to use find, use -prune at the end of
the sentence, but you must be sure you are making the right
search sequence, and not using "-prune" as part of your
search....

   ... with find, you're using an F-16 to kill flies...


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question