On 21 August 2013 16:01, Glenn Fowler <[email protected]> wrote: > > On Tue, 20 Aug 2013 22:13:11 +0200 Dan Shelton wrote: >> Does the Korn shell pattern syntax have an AND operator equivalent to >> & in grep -X or ~(X)? > > here is an example using var expansion editing > > ksh -c 'v=abcd; print ${v/@(+([abc])&*([bcd]))/X}' > > you can see a more examples in the ast regex regression tests > > cd $PACKAGEROOT/src/cmd/re > grep $'^K\t.*&' *.dat > > the *.dat file format man page is embedded in testregex.c in that same dir > > RE conjunction is typically combined with negation > I use it this way a lot > > print rm @(*.c&!(precious.c)) > > you can test ksh93 patterns with grep but be sure to use the -x option > because shell glob pattern matching is anchored > > print $'foo.c\nprecious.c\nnotprecious.c' | > grep -Kx '@(*.c&!(precious.c))' > > should produce > > foo.c > notprecious.c
Thanks. I wish you'd have EXAMPLE sections in the manpage. Dan _______________________________________________ ast-users mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-users
