[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch #6111] Shell script that produces a pipeline of greps

From: Stepan Kasal
Subject: [patch #6111] Shell script that produces a pipeline of greps
Date: Mon, 23 Jul 2007 13:39:37 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070530 Fedora/ Firefox/

Update of patch #6111 (project grep):

                  Status:                    None => Wont Do                
             Assigned to:                    None => kasal                  
             Open/Closed:                    Open => Closed                 


Follow-up Comment #1:

  with the description:

> comma stands for logical or, minus for logical not, and everything else is

I would interpret "image,picture -gtk,gnome" as
   image OR (picture AND NOT gtk) OR gnome
because unary operator usually has the highest priority, and AND usually has
higher priority than OR.
And I would expect the script would interpret parentheses as well.

But I think it is more natural to use awk for such a task, instead of several
processes.  For example, the above example can be implemented with GNU awk
this way:

$ apt-cache search view |
        (/image/ || /picture/) && !(/gtk/ || /gnome/)'

As you see, you can use the full power of logical expressions.

Or, if portability to any POSIX-conformant awk implementation were needed:

$ apt-cache search view |
  gawk '{l=tolower($0)};
        (l~/image/ || l~/picture/) && !(l~/gtk/ || l~/gnome/)'

To conclude, I do not think your script is suitable for inclusion to the GNU
grep distribution.

In any case, thank you for your suggestion!

Have a nice day,
    Stepan Kasal


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]