Solved

Avoiding 'Find' to search in subdirectories

Posted on 1997-11-10
6
456 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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 50 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

807 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