The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Question on Regular Expression Katkota UNIX for Dummies Questions & Answers 14 05-18-2008 02:11 PM
Regular Expression question Katkota UNIX for Dummies Questions & Answers 6 05-14-2008 12:23 PM
question (regular expression related) metalwarrior UNIX for Dummies Questions & Answers 1 02-03-2008 07:51 PM
Regular expression question umen Shell Programming and Scripting 7 11-21-2007 05:45 PM
question about regular expression brentdeback Shell Programming and Scripting 0 11-14-2005 12:04 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-19-2006
Registered User
 

Join Date: Dec 2005
Posts: 9
Regular Expression Question

Hi - I am trying to ignore the following items from a list.

lp0
lp11
lp12
lp14

The following code works fine, but I was wondering if there was a tidier way to write the lp[0 |11|12|14] regular expression?

Code:
egrep -v "lp[0 |11|12|14]"
Thanks in advance.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-19-2006
linuxpenguin's Avatar
Registered User
 

Join Date: May 2002
Location: India
Posts: 295
hmm, dunno why you would think the above is not tidy.
but here is another version you may want to use

grep -v "lp[01][ 124]" filename
__________________
War doesnt determine who is right, it determines who is left
Reply With Quote
  #3 (permalink)  
Old 01-20-2006
Registered User
 

Join Date: Dec 2005
Posts: 9
Thanks linuxpenguin.

Maybe I am being a bit picky.
Reply With Quote
  #4 (permalink)  
Old 01-20-2006
aigles's Avatar
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,199
Quote:
hmm, dunno why you would think the above is not tidy.
but here is another version you may want to use

grep -v "lp[01][ 124]" filename
This command ignore all that lines :
lp0
lp01
lp02
lp04
lp1
lp11
lp12
lp14
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0