How to do grep -v?

Hi

Is there a more direct way than this to get ‘grep -v’?

c=%w{a b c} #=> [“a”, “b”, “c”]
c -= c.grep(/a/) #=> [“b”, “c”]

I would much rather do:

c.grep!(/a/v)
or
c.grep!(/a/,‘v’)

···


Jim Freeze

You too can wear a nose mitten.

irb(main):001:0> %w[ a b c ].select { |those| those !~ /a/ }
[“b”, “c”]

-a

···

On Fri, 31 Jan 2003, Jim Freeze wrote:

Hi

Is there a more direct way than this to get ‘grep -v’?

c=%w{a b c} #=> [“a”, “b”, “c”]
c -= c.grep(/a/) #=> [“b”, “c”]

I would much rather do:

c.grep!(/a/v)
or
c.grep!(/a/,‘v’)

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================