Re: Basic Grep Question

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

 



On 13Mar2007 15:42, Dan Track <dan.track@xxxxxxxxx> wrote:
| Could someone please tell me how I can grep for two or more different
| words in one command instead of piping them through.
| 
| e.g I don't want to do
| 
| cat /tmp/file | grep -v cat | grep -v grey
| 
| I'd like to run that from one grep command.

Various people have mentioned egrep's '(foo|bar)' notation.
Good for OR. For AND I start reaching for sed, since you
can write more logic. I have a script here:

  http://www.cskk.ezoshosting.com/cs/css/bin/grepall

that constructs a sed command to do AND, and runs it,
so (for the inverse of your example):

  grepall hairy grey cat < /tmp/file

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

My computer always does exactly what I tell it to do but sometimes I have
trouble finding out what it was that I told it to do.
        - Dick Wexelblat <rlw@xxxxxxx>

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux