Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!ukc!its63b!bob From: bob@its63b.ed.ac.uk (ERCF08 Bob Gray) Newsgroups: net.unix Subject: Re: Wildcard-specs Message-ID: <77@its63b.ed.ac.uk> Date: Thu, 9-Oct-86 12:46:12 EDT Article-I.D.: its63b.77 Posted: Thu Oct 9 12:46:12 1986 Date-Received: Fri, 10-Oct-86 01:51:45 EDT References: <4162@brl-smoke.ARPA> Reply-To: bob@its63b.ed.ac.uk (Bob Gray) Organization: I.T. School, Univ. of Edinburgh, U.K. Lines: 57 In article <4162@brl-smoke.ARPA> lacasse@RAND-UNIX.arpa writes: > >If you have all day, you can use: > find . -exec grep string {} \; You would be faster with grep string `find . -print` provided that there weren't too many filenames. There is a limit built into your system on the number of parameters you can pass in an exec(). It has always seemed odd to me that a system with a hierarchical file system didn't have some pattern which recursively matched to sub directories and the files in them. It would be very nice to do something like vi **.mk to edit all the makefiles in a particular set of directories. In most cases the pattern matching of e.g. ls -l ** has the same meaning as ls -l `find . -print` The problems begin when you attempt to make the "**" wildcard as general as the other metacharacters. The pattern "**x**" means "find any file or directory which has the letter x in its name. match to either the filename or to ALL the files in the sub-tree if it is a directory. i.e. **xyz** should match to abcxyz.x abc/abcxyz.y abc/def/xxyzz/a.c abc/def/xxyzz/b.c abc/def/xxyzz/d.c abc/def/xxyzz/e.c I started to implement "**" pattern matching in the Bourbe shell a few years ago. Getting it to match with example 1. was fairly trivial. The more general "**xyz**" case caused an explosion in the number of filename matches before sorting and elimination of duplicates. It was very easy to run out of space on the machine I was working on in those days. If I dig the code out of the archives, what sould happen in a command like cp **.c x where x is a directory. Should the shell quietly make new directories or should it issue seperate cp commands for each target directory, then let cp complain if they don't exist. Bob Gray. ERCC.