LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-18-2008, 08:14 PM   #16
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743

Hmmmmmm...

From the man page:
Quote:
-P, --perl-regexp
Interpret PATTERN as a Perl regular expression. This is highly
experimental and grep -P may warn of unimplemented features.
 
Old 12-18-2008, 08:25 PM   #17
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by pixellany View Post
Hmmmmmm...

From the man page:
I used it a lot. I had a problem one time on pretty ancient RHEL4, and that problem wasn't present on my home much newer SUSE.

Anyway, there is 'pcregrep' :-).
 
Old 12-18-2008, 09:23 PM   #18
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by pixellany View Post
egrep -v '(delayed|finish)' textfile.txt | wc -l
AFAIK, OP wanted to exclude "delayed" AND "finish" , the alternation operator is an "OR" function.

@OP, use awk
Code:
awk '!/delay/ && !/finish/' file
 
Old 12-18-2008, 09:36 PM   #19
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 43
Quote:
Originally Posted by ghostdog74 View Post
AFAIK, OP wanted to exclude "delayed" AND "finish" , the alternation operator is an "OR" function.
DeMorgan's Law

-v means to invert the matching, so -v (X | Y) == !X & !Y
 
Old 12-19-2008, 03:15 AM   #20
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
egrep -v '(delayed|finished|blah|blooh)'

or words in a list file:

grep -vf list infile
 
Old 12-19-2008, 04:27 AM   #21
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 60
And, one more time, since I think it's gotten lost in the pile: add a -c flag and leave out wc -l:
Code:
grep -vc 'delayed\|finished' filename
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I "cat" or "grep" a file to ignore lines starting with "#" ??? callagga Linux - Newbie 7 08-16-2013 06:58 AM
Omit "Member Intro" from Zero Reply Threads MS3FGX LQ Suggestions & Feedback 4 07-08-2008 07:24 AM
Sed/Awk: print lines between n'th and (n+1)'th match of "foo" xaverius Programming 17 08-20-2007 11:39 AM
Will /etc/fstab device "lines" from Mandrake work in Debian? gpfromnc Debian 12 04-27-2006 03:13 PM
apache logs showing strange "SEARCH /\x90\x02\xb1" lines TheOneAndOnlySM Linux - Software 1 06-28-2004 04:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration