The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep for a particular pattern and remove few lines above top and bottom of the patter fed.linuxgossip Shell Programming and Scripting 17 07-25-2008 05:29 AM
Add new lines with a space in beginning Aejaz UNIX for Advanced & Expert Users 8 05-01-2008 09:21 AM
Adding words to beginning of lines Ernst Shell Programming and Scripting 9 04-03-2008 11:23 AM
grep required pattern and next 2 or 3 lines cvvsnm UNIX for Dummies Questions & Answers 3 02-01-2008 01:20 AM
grep to show lines only after pattern wannalearn Shell Programming and Scripting 5 10-08-2007 11:44 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-29-2005
Registered User
 

Join Date: Aug 2003
Location: Ireland
Posts: 269
Stumble this Post!
grep - to exclude lines beginning with pattern

11132
13069
11137
11142
13070

Can I use grep command to exclude all lines beginning with 13?
I dont want to use grep -v 13 as potentially there will be a number with something like 11013 that I would exclude in error..
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-29-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,658
Stumble this Post!
You can have a regex as a search pattern for grep.

Code:
grep -v '^13' myfile
Vino
Reply With Quote
  #3 (permalink)  
Old 08-29-2005
Registered User
 

Join Date: Aug 2003
Location: Ireland
Posts: 269
Stumble this Post!
Perfect- couldnt remember the syntax..

Thanks!!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:52 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