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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find question??

Status
Not open for further replies.

teser

Technical User
Mar 6, 2001
194
0
0
US
I submitted this find command that searches most subdirectories. But it does not cover every subdirectory. I changed some subdirectory names from upper case to lower and that helped but it still didnt solve the problem. How can I get my find statement to search and get an awk response in EVERY subdirectory. Also the
permissions are the same in every directory so it isnt a permissions issue.

Here is my find statement:

find . -depth -name "*.html" -print |
xargs awk '/<TITLE>|<[Tt]itle>/ {printf(&quot;%s\t%s\n&quot;, FILENAME, $0)}'
 
that's weird - what do the directories that are being missed have in common? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Some had upper case characters in the name such as &quot;DIR&quot; where the whole name was upper case. This find works on some directories covering all subdirectories, yet it won't all the way through on other subdirectories.
 
I've not come across this behaviour of &quot;find&quot; before - so I'll tuck it away and bear it in mind.

Are there some filenames that contain control characters?

What version of UNIX are you running? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Hello Teser,
it's not clear to me why you use the &quot;-depth&quot; flag and also I can't see the necessity of piping find's output to xargs. I'm not familiar enough to xargs but what I learned from the man pages is the existence of some restrictions concerning the length of the resulting string.
I would do the job with the following find:
find . -type f -name &quot;*.html&quot; -exec awk '/<TITLE>|<[Tt]itle>/ {printf(&quot;%s\t%s\n&quot;, FILENAME, $0)} {} \;'

Regards
Michael.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top