filename substitution question

Peter Johnson ~ pete at escher.intel.com
Fri Mar 24 16:08:41 AEST 1989


In article <9911 at smoke.BRL.MIL>, gwyn at smoke (Doug Gwyn ) writes:
>In article <1627 at ncar.ucar.edu> rob at 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 at escher.intel.COM
{amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!pete



More information about the Comp.unix.wizards mailing list