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
command for selecting specific lines from a script gardasgangadhar UNIX for Dummies Questions & Answers 1 05-13-2008 02:29 AM
merge based on common, awk help jkl_jkl Shell Programming and Scripting 3 03-17-2008 03:13 AM
Help with selecting specific lines in a large file tansha UNIX for Dummies Questions & Answers 2 02-06-2008 04:26 AM
how to take out common of two lines in a file jam_ali49 UNIX for Advanced & Expert Users 6 11-23-2007 12:48 AM
Search file for pattern and grab some lines before pattern frustrated1 Shell Programming and Scripting 2 12-22-2005 11:41 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-27-2008
Registered User
 

Join Date: May 2008
Posts: 11
selecting only few lines from many based on a common pattern

Hi,
I have a file having some thousand records with the following sort of lines:

Error: Failed to get order data
Order: PO-BBBTGZE
Error: No CLI
Error: Failed to get order data
Order: PO-SBDJUZA
Order: PO-XBBIDEN
Error: No CLI
Error: Failed to get order data
Order: PO-BBDJUTQ
Order: PO-FBCSPHC
Error: No CLI
Error: Failed to get order data
Order: PO-FLBVKYV
Error: No CLI
Error: Failed to get order data
Order: PO-KBDASSI
Order: PO-HBBGQCE
Error: No CLI
Error: Failed to get order data
Order: PO-RBDDJKT
Order: PO-RBDDJKM
Error: No CLI
Error: Failed to get order data
Order: PO-EBDCFLJ

I wish to only retrieve the lines marked red and none else. i.e. any line with the line after it starting in ERROR is not desired.

Any Directions shall be highly appreciated.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-27-2008
Registered User
 

Join Date: May 2008
Posts: 11
Hi,
Can anyone please help me ?
Reply With Quote
  #3 (permalink)  
Old 05-28-2008
Registered User
 

Join Date: Jun 2007
Posts: 47
grep -v "^Error" <file name>
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:14 PM.


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

Content Relevant URLs by vBSEO 3.2.0