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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
#/usr/bin/csh -f not working as expected? effigy Shell Programming and Scripting 4 06-05-2006 05:00 PM
Find command not working as expected mpflug UNIX for Dummies Questions & Answers 2 02-09-2006 08:32 PM
Var substitution in awk - not working as expected videsh77 Shell Programming and Scripting 3 01-13-2006 01:57 PM
ls not working as expected within ksh GNMIKE Shell Programming and Scripting 10 07-07-2005 07:53 AM
which not working as expected osee Shell Programming and Scripting 2 09-07-2004 11:37 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-28-2007
Vishal123 Vishal123 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 3
Find cmd not working as expected

Hi,

i wan to search the file starting with Admin into the directory Output. I am running below command:

find /appl/Output -name "Admin*" -prune

but this command is going into the sub directories present under output. I do not want to search under sub directories. Any help will be highly appreciated.

Thanks!!
  #2 (permalink)  
Old 08-28-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
try -maxdepth as follows..

Code:
       -maxdepth levels
              Descend at most levels (a non-negative integer) levels of direc-
              tories below the command line arguments.   `-maxdepth  0'  means
              only  apply the tests and actions to the command line arguments.
  #3 (permalink)  
Old 08-28-2007
Vishal123 Vishal123 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 3
-maxdepth option is not allowed

Thanks for ur quick reply. but -maxdepth option is not supported with my unix verison. I have version 5 of unix.
when i tried to run find /appl/Output -name "Admin*" -prune -maxdepth 0 it gave error saying "find: 0652-017 -maxdepth is not a valid option."

Pls help.
  #4 (permalink)  
Old 08-28-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Why are you using find if you are not recursing through directories?

echo /appl/Output/Admin*
  #5 (permalink)  
Old 08-28-2007
Vishal123 Vishal123 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 3
actually i want to search based upon the file created time & file modified time. For that i have to use find command.
  #6 (permalink)  
Old 08-29-2007
ahmedwaseem2000 ahmedwaseem2000 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Bangalore
Posts: 219
you could use the option mtime in the find command to search based on the modified time of the file.
  #7 (permalink)  
Old 08-29-2007
namishtiwari namishtiwari is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2007
Location: Bangalore
Posts: 377
either you can use--

ls -ltr /appl/Output/Admin*

Thanks
Namish
Sponsored Links
Closed Thread

Bookmarks

Tags
mtime

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:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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