Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search thru directories for a match 1

Status
Not open for further replies.

frangac

Technical User
Feb 8, 2004
163
ZA
Hi All,

Can awk search thru directories and find pattern matches for e.g.
My Directories are structured as follows :

20040801/
20040802/
20040803/
2004..../
2004..../
2004..../
20040908/

Given $1 as 20040908, $2 as 20040909 and $3 as your pattern match (Chris). Search thru dir, greater than < 20040904 and less > 20040909 for pattern Chris.

If so please post an example.

Many Thanks
Chris
 
man find

not tested, but should give a starting point. You should define more clearly by "pattern Chris". Pattern in the file name OR in the content of the file?

Code:
#!bin/ksh
find * -type d -prune | while read curDir do
  if (( curDir> 20040904 && curDir < 20040909 )) ; then
      find curDir -type f -name 'Chris'
  fi;
don;

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top