Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!intelca!mipos3!pete From: pete@escher.intel.com (Peter Johnson ~) Newsgroups: comp.unix.wizards Subject: Re: filename substitution question Message-ID: <3806@mipos3.intel.com> Date: 24 Mar 89 06:08:41 GMT References: <1627@ncar.ucar.edu> <9911@smoke.BRL.MIL> Sender: news@mipos3.intel.com Reply-To: pete@escher.intel.com (Peter Johnson ~) Organization: Intel Corporation Lines: 32 In-reply-to: gwyn@smoke.BRL.MIL (Doug Gwyn ) In article <9911@smoke.BRL.MIL>, gwyn@smoke (Doug Gwyn ) writes: >In article <1627@ncar.ucar.edu> rob@scdpyr.ucar.edu (Robert Montgomery) writes: >>Often it would be simpler to specify what I *don't* want in filename >>substitution than what I do. For example, I would like to do something >>similar the following: >> ls {NOTfrog}.c >>and have it produce: >> bird.c fish.c > >Unfortunately the shell's pattern expansion capabilities support only >a subset of the regular expression capabilities that you might expect >of a UNIX utility. However, therein lies the clue: use some other >UNIX utility. For example: > ls `echo *.c|sed 's/frog.c/ /'` >Not as convenient as what you really want, but at least the capability >is available. I use a program written by Chris tweed called "sets". This program just does set operations on its arguments. So for example if you wanted to remove all files except those that end in .c or .h you can do something like this: rm `sets * -d *.c` The -d stands for set difference. Sets also supports intersection and union. If you are interested, let me know and I will mail you a copy. Peter Johnson pete@escher.intel.COM {amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!pete