Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!texsun!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.editors Subject: Re: One user's editor wish list Message-ID: <1991Mar20.203401.26237@convex.com> Date: 20 Mar 91 20:34:01 GMT References: <1991Feb22.134323.20410@scrumpy@.bnr.ca> <11032@dog.ee.lbl.gov> Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 33 Nntp-Posting-Host: pixel.convex.com From the keyboard of torek@elf.ee.lbl.gov (Chris Torek): :This is fixed in 10th Edition Unix. It is just an accident of history. :There *is* a reason for some difference, actually: Editors must have :a way of marking matches for substitutions, while pure matchers (grep) :do not need this. Untrue. I use \references on the LHS of my substitutes, albeit infrequently. For example: prep '(\w+)\s+\1' *.ms to find repeated words on the same line in a document. --tom ps: prep basically works out to be an alias like this: alias prep "perl -ne 'print if /$^/' \!:2-$" accept I don't require the filenames. In straight egrep, you would say: egrep '([a-zA-Z0-9_]+)[ ^I]+\1' *.ms In grep it's more cumbersome still for lack of + operator. Perl regexps have some other nice properties, too, but I won't get into that here. Anybody got a good way of doing "word-boundaries" in egrep? In grep you can use -w, but only gnu's egrep takes it. I use \b in perl, \< in vi, but egrep is a pain for this. Well, that's what the prep alias is for I guess. --tom