On Jan 19, 2011, at 15:55, Ronald J Kimball wrote:
> Oh, in that case, you could pipe the output through grep:
> find /Applications/ -name "*.app" | grep -v -E '.*\.app.*\.app'
> But I think what you really want is -prune:
> 
> find . -name "*.app" -prune

Hey Ronald.

Ha!  I know about the reverse-select switch in grep and just didn't think about 
it a't'all, but I totally missed the -prune switch when I was going through the 
'find' man page.  It's really fast with the -prune switch active too.  Goodie, 
goodie.  :)

If I run that from Applescript it throws a couple of errors:

find: ./Utilities/Utilities (Chris)/Unix 
Utilities/Manner/.Spotlight-V100/Store-V1: Permission denied
find: ./Utilities/Utilities (Chris)/Unix Utilities/Manner/.Spotlight-V100: 
Permission denied

The Terminal just prints them and gets on with life, but this stymies things in 
Applescript.  The only way I've found around it is to write the results to a 
file and then read them back into the script.

--
set reportFile to "Odin:Users:stone:Desktop:Test_Find.txt"
try
  do shell script "find /Applications/ -name \"*.app\" -prune > 
~/Desktop/Test_Find.txt"
end try
set reportText to read alias reportFile
--

Is there a better way?


On Jan 19, 2011, at 17:22, LuKreme wrote:
> Ah, in that case you might want to look into using mdfind or `find … | grep 
> -e`

I usually use the 'egrep -i' option, but yes.  Ah.  I'd forgotten about mdfind; 
thanks for the reminder - there are other things I want to do with it.


On Jan 19, 2011, at 19:10, Doug McNutt wrote:
> Have a look at the <*> construct in perl which returns a list of all files in 
> the current directory. The * is really a perl "glob" and you can put a 
> regular expression there.

Thanks Doug.  Eventually Perl will probably be the way to go; it's just that 
*I* have a way to go with Perl to get there.  :)


Again: Many thanks to all for the useful instruction.

--
Best Regards,
Chris

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to